Bind data to a property or element
- On the artboard, click the element in the layout that you want to create the binding on—this is where the data will flow into from the data source.
- In the Properties panel, click the Advanced Property Options button next to the property that you want to serve as the target for the binding—this is the specific property that will hold the data.
- In the pop-up menu, click Data Binding.
- In the Create Data Binding dialog box, do one of the following:
- To bind to a field of a data source, click the Data Field button at the top of the dialog box. The list on the left side of the dialog box shows all the available data sources for the current document. As you change among the data sources in the list, the list on the right shows all the data fields for the selected data source. Select a data field in the list to serve as the binding source, and then click Finish.
- To bind two properties of layout elements together, click the Element Property button at the top of the dialog box. The list on the left side of the dialog box shows all the available elements in the current document. As you change among the elements in the list, the list on the right side shows the properties for the selected element. Select a property in the list on the right to serve as the binding source, and then click Finish.
- To bind to an explicit data context, click the Explicit DataContext button at the top of the dialog box if a data context has been defined for the element that you are binding to. A single list will appear, showing all of the fields that are available for the current data context. Select a data field to serve as the source for the binding, and then click Finish.
- Under Data in the Project panel, click the data source field that you want to bind to, and then drag it onto the artboard. You can drag the data source field onto an empty part of the artboard or place it within an existing layout element.
- After you drag the data field into the desired location, a pop-up menu opens to prompt you to select the type of control to create to represent the data. If you drag the data source field over an existing element, you are also given the option to bind the data to that element.
- After selecting the type of control to use for the data, you will see
the new control on the artboard. You are then prompted to select the
property on that control to bind the data to. Select the property, and then
By default, the property that is usually the most appropriate for the current control type is automatically selected, so in most cases you can just click OK to confirm the selection.