The Macro SDK template contains all of the structure and configurations you need to get started. These include:
In Visual Studio's Solution Explorer pane (on the right), open the MyFirstMacro.xaml file..
On the left side of the screen, click Toolbox.
Click the pin icon at the top of the pane so it stays open for the next steps.
In the Toolbox pane, right-click All WPF Controls, and select Choose Items.
Click the WPF Components tab and then click Browse.
Navigate to C:\Program Files (x86)\Trimble\Macros SDK\, and select Trimble.Vce.UI.Controls.dll.
In the Choose Toolbox Items dialog, you will now see the custom TBC controls highlighted.
Click OK. Notice the TBC custom controls at the bottom on the All XAML Controls list now.
Press F5 to refresh the project.
Double-click one of the custom controls to add all of the custom controls DLLs as references.
You can create user interfaces for your apps by dragging controls from the Toolbox and setting properties in the Properties window.
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.
At the bottom of the graphic view, click the Vertical Split icon so you can see both the source and Designer side by side.
In the source view, type <Label Content=”Hello world”/> between <Grid> and </Grid> to see it appear in the Designer view.
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.
Use the center grip to position the control and the corner and side grips to resize the control.
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.
IsChecked="true"
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.
If you open the associated .py file, you can see where the corresponding .xaml file is referenced under class.
Close the tab when you are done experimenting.
Hello David. I noticed this was first published 05-01-2018. Would you be able to update the documentation along with screenshots?
Hi,
On the right double click on:
Two windows should appear:
When XAML window is active, "All WPF controls will appear" in the Toolbox on the left:
That's where you should right click and follow the list you cited.
Hello Good TBC Community,
I'm stucked at these steps of the process,
I just can't figure out what to do on VS.
Can anybody help me with this?
Regards
Hi Gary,
Your method was useful!Thanks!
"F5" starts the debugger. You need to change the Python Environment to IronPython. At the top of Visual Studio where is says "Python 3.7 (64 bit)", change the environment to "IronPython (32 bit)". If IronPython is not listed there, you need to install it. (IronPython ) (Just download the MSI file)
When I Press F5 to refresh the project.
VS 2019 popup prompt:
What is the reason for this?