XAML GridView design time data from json XAML GridView design time data from json json json

XAML GridView design time data from json


this is an advice more than an answer. JSON design data seems to be supported only by Windows 8.1 projects.I suggest another solution, using a mock class that provide the properties you need. In your case you could create a SampleData class with the ListItems property:

public class ListItem{    public string Name { get; set; }}public class SampleData{    //Parameterless constructor needed!    public SampleData()    {        ListItems = new ObservableCollection<ListItem>();        ListItems.Add(new ListItem { Name = "foo" });        ListItems.Add(new ListItem { Name = "bar" });    }    public ObservableCollection<ListItem> ListItems { get; set; }}

The SampleData class needs to have a parameterless constructor!

In the XAML file just add the design-time datacontext (the local tag referr to the SampleData class assembly;

...xmlns:local="clr-namespace:WpfDesignDataTest"...<ListView Grid.Row="1" Grid.Column="0" ItemsSource="{Binding ListItems}" d:DataContext="{d:DesignInstance Type=local:SampleData, IsDesignTimeCreatable=True}">