XAML Tips: How to generate Sample Data from ViewModel Class

XAML Tips: How to generate Sample Data from ViewModel Class

I recently tried to create sample data by hand for XAML Designer. If you don’t know what is sample data used for then read this article

Its really pain to type all properties of ViewModel class specially if you have lots of nested objects from different namespaces. You can easily make mistake and scratch your head for hours.

Here is very simple tip (This assume you have Expression Blend 4 Installed along with VS2012. I don’t know if Sample Data Generation feature available for Blend 3 so please don’t assume this will work for older version)

1. Right Click anywhere in your VS2012 solution explorer and Open any file with Blend

2. Once Blend is loaded click Data Tab (Usually found on Right Hand Side along with Properties Tab). If you don’t see Data tab next to properties then Reset WorkSpace.. this bring back to default window layout.


3. Click small Database with Plus icon. And select generate Sample Data from Class


4. On popup list select your class which needs to be used to generate sample data. Hit OK.


5. Now if you switch back to VS2012 solution you will see project reload message and after that you should find XAML file with sample data (usually located inside \SampleData folder)

 

I was inspired for this tip from this link

 

 

 

 

 

Binary World is a Software Development company located in Atlanta, USA (since 2007). Binary World specialized in Business Intelligence, mobile, cloud computing and .Net Application Development.

Leave a Reply