I have a tab control with a data template that renders data based on the template and the data on the source it is bound to.
However, this instantly makes UI development harder as I don’t see anything in Visual Studio 11, because all data comes when the application is running. Is there some way to add test data that only appears while working with the UI?
This tutorial from MSDN was perfect: http://msdn.microsoft.com/en-us/library/ee823176.aspx
Basically:
Create a file
DesignData/FooData/Foo.xamlwith content such as:Note that
Foomust be a class that exists under the namespaceYourProjectwith the properties you just used.Then select the file from the Solution Explorer and set the Build Action to
Design Data.Add a namespace to your
MainWindow.xamlcode:along with the other namespaces you have.
Then add this to your top-level Grid for instance:
Now elements below that Grid element (under the influence of DataContext) can have the property:
In my case I used a tab control and my data context was a collection
DesignData/FooData/FooCollection.xaml: