03 Configuring Your Visual Studio Project

Document created by David Kosakowski on May 1, 2018Last modified by David Kosakowski on Sep 4, 2018
Version 9Show Document
  • View in full screen mode

The Macro SDK template contains all of the structure and configurations you need to get started. These include:

  • Links to program DLLs
  • Environments and references
  • Setup for debugging

Making TBC Controls Available in Your VS Project

  1. In Visual Studio's Solution Explorer pane (on the right), open the MyFirstMacro.xaml file..

  2. On the left side of the screen, click Toolbox.

  3. Click the pin icon at the top of the pane so it stays open for the next steps.

  4. In the Toolbox pane, right-click All WPF Controls, and select Choose Items.

  5. Click the WPF Components tab and then click Browse.

  6. Navigate to C:\Program Files (x86)\Trimble\Macros SDK\, and select Trimble.Vce.UI.Controls.dll.

  7. In the Choose Toolbox Items dialog, you will now see the custom TBC controls highlighted.

  8. Click OK. Notice the TBC custom controls at the bottom on the All XAML Controls list now.

  9. Press F5 to refresh the project.

  10. Double-click one of the custom controls to add all of the custom controls DLLs as references.

Adding Controls to the UI

You can create user interfaces for your apps by dragging controls from the Toolbox and setting properties in the Properties window.

  1. Select Project > Add New Item > IronPython WPF Window, and click Add to open a new XAML file.If the graphical Designer window does not open, right-click the .xaml file in the Solution Explorer, and select Include in Project to open it.

  2. At the bottom of the graphic view, click the Vertical Split icon so you can see both the source and Designer side by side.

  3. In the source view, type <Label Content=”Hello world”/> between <Grid> and </Grid> to see it appear in the Designer view.

  4. Click-and-drag several of the WPF and TBC custom controls into the view as well. This is how you layout a command's UI. Notice how code for each control is added to the right pane as you do this.

  5. Use the center grip to position the control and the corner and side grips to resize the control.

  6. To add more controls, type the beginning of the control name and select the appropriate tag. For example, type <checkb... You will see Intellisense offer suggested tags. Select CheckBox and then Content.

    Note: You can press Enter when the auto-fill (Intellisense) suggests the correct tag. Note: If you are not receiving Intellisense prompts as you type, you may need to add a WPF project or reference a 32-bit version of TBC. Note: You can add code to say what the state of the checkbox does in terms of operations. If you want enabled/checked to be the default for a checkbox, add the code.


    The Designer offers many more controls you can use. This shows how easy it is to add UI, especially if the commands are written in WPF.

  7. If you open the associated .py file, you can see where the corresponding .xaml file is referenced under class.

  8. Close the tab when you are done experimenting.

Next topic: 04 Familiarizing Yourself with the Predefined Macros