Anatomy of a .xaml File

The .xaml files in Data Standard have some basic components that create the Data Standard dialog, such as Grids, ComboBoxes, Labels, TextBoxes, and Buttons. Autodesk recommends making sure you understand these components before you customize or create your own Data Standard dialogs.

Note: Many of these components have more complex parameters than those explored in this topic. This topic is meant to address the basic behaviors of these components.

Grid

The Grid is a layout panel that controls everything in a tabular structure of rows and columns. All cells (a cell is unique by its combination of a row and a column) can contain multiple controls, like labels and text boxes.

This is the basic structure of a grid. The grid needs some Rows which you define in the Grid.RowDefinition part. Height 30 defines a fixed value for the height and cannot be changed afterwards. The value "auto" gives the row a dynamic height, so it can be thicker or thinner, depending on the controls. The same values apply to the Column width.

Controls

After defining your rows and columns. you can add controls, such as labels and text boxes. Controls must be attached at the two properties: Grid.Column and Grid.Row. These properties definesthe location of the control in the grid. The first row is 0, so the second row is 1, etc.

All of the following elements are controls.
  • Labels

    Labels are simply field names that you cannot edit. They contain text that indicates what the label is for, so the user knows which type of value has to be inserted in the corresponding text box or combobox. For example, a label called Comments might be located beside an empty text box. The user would know to answer any comments in that text box.

    The Label has a Content property. This property is the text that is displayed for the label.

    <Label Grid.Row ="0" Grid.Colum="0" Content="sample" />
    
  • Text Boxes

    Text boxes are fields that can be edited. The user can enter something into the text box. Data Standard can read the entered value and use it for other operations.

    The text box needs the following properties:
    • Text: The initial text that you want to display in your text box as a sample. If you write content="Enter Comments Here" then the text box contains "Enter Comments Here" at the beginning and is not empty.
    • Name: Gets or sets the identifying name of the element. The name provides a reference so that code-behind it, such as event handler code, can refer to an element.
    <TextBox Grid.Row="0" Grid.Column="0" Text="{Binding Prop[State].Value}" Name="testtextfield" />
    
  • ComboBox

    Combo boxes are fields that cannot be edited but that let the user choose directly from a list of existing options. If configured, this value can be extracted for later operations.

    The combo box needs the following extra properties:
    • Itemsource declares where this control is getting its list of values available for user selection.
    • Text: The initial text that you want to display in your combo box as a sample. If you write content="United States" then the default option for the combo box is "United States" and is displayed in the combo box.
    • Name: Gets or sets the identifying name of the element. The name provides a reference so that code-behind it, such as event handler code, can refer to an element.
    <ComboBox Name="MaterialCombo" Text="{Binding Prop[Cost].Value}" Grid.Column="3" Grid.Row="6" ItemsSource="{Binding Prop[Cost].ListValues}"/>
  • Buttons

    A button is a user interface element that provides the user a simple way to trigger an event, such as Search or Save.

    The button needs the Command property. This property identifies which action gets executed when the button is triggered.

Binding

To use one of these components to control or change a Vault file property, you need to understand "{Binding Prop[cost].Value}." Binding lets you map values to certain Vault file properties. For example, you could bind the text of a Text Box to the cost property in Vault so that every time something is entered in this particular text box, the Cost property gets automatically updated in Vault. Binding is a great way to automate property changes, leaving less work for the end user.

Prop [ ]

Prop[ ] is an essential function for binding. With it you can access the properties of a file in Vault. If you want to map a text box to the property Engineer, write: <TextBox text="{Binding Prop[Engineer].Value}"/>. When the text box is created, Prop[ ] returns the value of that property. Every time the text box gets updated, it notifies the Prop[ ] function which writes the new value to the mapped file property. .