DataGrid for WPF and Silverlight Overview > [No Target Defined] > [No Target Defined] > Step 2 of 3: Adding a Data Source to the Project |
In this step you'll add a data source to your application and add external files to set up the data source. Note that to simplify the tutorial, this step uses files included with the C1DataGrid_Demo sample included with Silverlight Edition. You can refer to pre-installed product samples through the following path:
Documents | ComponentOne Samples | Silverlight
To add a data source, complete the following steps:
1. In the Solution Explorer window, right-click the MasterDetail project and select Add | New Folder. Rename the folder "Resources".
2. In the Solution Explorer window, right-click the Resources folder and select Add | Existing Item.
3. In the Add Existing Item dialog box, navigate to the C1DataGrid_Demo\Resources sample folder, select the products.xml file, and click Add. This file provides that data you'll use in the project.
4. Select the products.xml file in the Solution Explorer, and in the Properties window set its Build Action property to Embedded Resource.
5. In the Solution Explorer window, right-click the MasterDetail project and select Add | Existing Item.
6. In the Add Existing Item dialog box, navigate to the C1DataGrid_Demo sample folder, select the Data.cs file, and click Add. This file contains code to set up the data source.
What You've Accomplished
In this step you added an XML data source. In the next step, you'll set up the row details section and finalize the application.