I have a simple view model that has a list of Units in it, this shows fine in run time, but I would like the list to show in design time. As per some questions around I have tried the following, but it is not working, can someone please help?
//In resources
<local:MainViewModel x:Key="DesignViewModel"/>
The Presenter
<ItemsControl ItemsSource="{Binding Units}" d:DataContext="{Binding Source={StaticResource DesignViewModel}}" Background="Transparent">
The view model
public MainViewModel()
{
Units = new ObservableCollection<UnitViewModel>();
Units.Add(new UnitViewModel
{
ID = "1",
Degrees = "80",
IsMaster = true
});
for (int i = 0; i < 10; i++)
Units.Add(new UnitViewModel
{
ID = "2",
Degrees = "40",
IsMaster = false
});
}
}