I would like to create sample data which are created only in design mode (When the WPF Window is shown in the Visual Studio WPF Designer or in Expression Blend). I tried this:
public MainWindow()
{
InitializeComponent();
if (DesignerProperties.GetIsInDesignMode(this))
{
DataContext = new Person() { Name = "Harry" };
}
}
It seems that the designer doesn't call the constructor of the Window class. I need to create the sample data in C# code because they are more complicated to instantiate. Any ideas?