Generate sample data
You can use the tools in the Data panel of Microsoft Expression Blend to generate sample data for your application. Sample data is useful when you are designing the appearance of controls that will display live data that you might not have access to at design time.
To generate sample data
To enable the sample data tools, open a XAML document on the artboard in Design view or Split view .
If you do not see the Data panel, make sure that a check mark appears next to Data on the Window menu.
For more information, see Add or remove a workspace panel.
In the Data panel, click Add sample data source , and then click Define New Sample Data.
In the Define New Sample Data dialog box, type a descriptive name for your data source in the Data source name field.
Under Create data source in, select one of the following:
Project Use this option to make the data available to all documents in the project.
This document Use this option to make the data available only to the currently-open XAML document.
If you want your application to be able to display sample data when you run it (F5), make sure Enable sample data when application is running is selected. If this option is not selected, you will be able to see sample data only on the artboard, and not in your application window at run-time.
Click OK to close the Define New Sample Data dialog box and create the sample data.
In the Projects panel, in a folder named SampleData, a subfolder is added for your new sample data source. It contains the files required to define the data.
In the Data panel, you can expand the nodes of your new data source to view the schema of your sample data. An initial collection of strings and boolean properties was generated by Expression Blend.
Note
The Data panel shows you the structure (or schema) of your data, not the data itself. For example, in the Data panel, you will see a Collection node, under which you will see a string property (Property1), meaning that your data consists of a collection of records where each record contains a string. To view the actual data that was generated, click Edit sample values next to the Collection node .
You can now drag the Collection node onto the artboard to create a list box, or onto an existing object, such as a DataGrid object, to display the data.
List of items created by dragging the initial generated collection onto the artboard
List of items after dragging the initial generated collection onto a DataGrid object
You can also modify the sample data, adding properties and changing values.
For more information, see Modify sample data.
See also
Tasks
Import sample data from an XML file