Generate Sample Data In Microsoft Blend

You can generate sample data that will be helpful in your app at design time. It is very useful in scenarios where you don't have access to real data while designing the UI of your app.

We'll be using data panel to generate sample data. I'm assuming you've already installed Microsoft Blend for Visual Studio and know how to perform basic operations like creating or opening projects.

Here are the steps:

  1. Click on Data in the left pane, then click on '+' icon (which says 'create sample data' on hover). Click on new sample data, edit data source name, leave the rest unchanged and click on OK.

    Project

    I've named my data source as Chairs. After the above step, you should see something like the following:

    Chairs

  2. Delete items folder as well as all properties (Property1, Property2, Property3) of Groups. Then click on '+' icon located in front of Groups to add a simple property. After adding, you can also change the type of properties by clicking on little icon in front of property.

    Description

    In the above image, you can see I've completed the 2nd step and created two properties; Description of type string and Image of type image.

  3. Finally, just drag and drop Groups on designer (MainPage.xaml). Sample Data will be populated, you can also test it by running on local machine.

    MainPage

    You can also edit these sample values by clicking on drum shaped icon right in front of Groups.

Conclusion

These are very easy steps to generate sample data or design time data for your app. This technique is quite useful when you're designing UI of your app. If you find any suggestion or question, please share in comments.

Originally published on TechNet Wiki


Similar Articles