Data Standard: how much WPF do you need to know?

Those, who attended the Data Standard trainings we ran around Europe, know this story. I grew up in South Tyrol (northern Italy), where we speak both, Italian and German. When I was a child, we used to spend the holidays at the Rimini beach, also well frequented by German families. I witnessed how young Italian males managed to engage with young German ladies, with just few words of German, and frankly even poorly pronounced. 30 years later, I realized that in order to engage with someone/something, it’s not necessary to fully master a language. So, you too can engage with Data Standard with just a minimal WPF knowledge. Here are the 4 WPF elements you should know: Label, TextBox, ComboBox, Grid.


Each element (control) has few required attributes. A Label has Content, where you put your text to be displayed. A TextBox has Text, which you bind with the according AutoCAD attribute, Inventor iProperty or Vault Property. A ComboBox is a bit more complex as it pulls data from the ItemsSource in order to fill up the selection list, and binds the SelectedValue to the according AutoCAD attribute, Inventor iProperty or Vault Property.

<Label Content="Title"/>
<TextBox Text="{Binding Prop[Title].Value}" Grid.Column="1"/>
<Label Content="Material" Grid.Row="2"/>
<ComboBox SelectedValue="{Binding Prop[Material].Value}" ItemsSource="{Binding Prop[Material].ListValues}" Grid.Column="1" Grid.Row="2"/>

That’s it! Well actually, all these controls would just fly randomly in the window if they would not have a clear position. Now, you could work with fixed positions or margin, but in order to take advantage of resizing, it’s better to embed such controls in a Grid. So, basically the Grid is just a canvas with several rows and columns, similar to a check-board or an Excel sheet. In this case, we have 2 columns, where the first has a fixed width of 80 pixel, and 3 rows, as the second row has a fixed height of 8 pixel and serves as a space between the controls. Here is how it looks like:


You can place your controls into single cells of the grid, you can combine cells together so that a control can cover multiple cells, similar as you would do it in Excel. The advantage of using a Grid is that you can easily rearrange rows and columns and all your controls still fit to the new allocation. That is why all controls, such as Label, TextBox, ComboBox and all other, have 2 additional attributes; Grid.Column and Grid.Row. The first cell (top, left) starts with row 0 and column 0. If these attributes are omitted, WPF presumed row 0, column 0. At the Grid, you will find Row- and ColumnDefinitions, which simply describes how many rows and columns the Grid should have.

    <ColumnDefinition Width="80"/>
    <ColumnDefinition Width="*"/>
    <RowDefinition Height="auto"/>
    <RowDefinition Height="8"/>
    <RowDefinition Height="auto"/>

Each RowDefinition will have a height and each ColumnDefinition will have a width. Keep in mind that Grid can be nested. In other words, you can have a Grid within a Grid. This way, you could have a main Grid with just the minimal rows and columns, and in specific cells, you can insert another Grid to split that cell once more and place according controls. Thus, with Grid, Label, TextBox and ComboBox, you are now ready to engage with your Data Standard dialog. Have Fun!!!

This entry was posted in Data Standard. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s