I have a usercontrol and viewmodel that exsposes a property Reports. The datacontext of usercontrol is bound to the viewmodel.
In the control i have a listbox the listbox is bound to property Reports
<ListBox x:Name="ReportListBox" ItemsSource="{Binding Reports}"
ItemTemplate="{StaticResource reportItemTemplate}"
IsSynchronizedWithCurrentItem="True"
Visibility="Visible" SelectionMode="Single">
</ListBox>
What i want is to have some design data so i created a xaml file like this.
<m:Reports xmlns:m="clr-namespace:MYAPP.Modules.ReportList.Models">
<m:Report ReportName="Reportname 1" Id="AAAA-BBB-CCC" ></m:Report>
<m:Report ReportName="Reportname 2" Id="AAAA-BBB-CCC" ></m:Report>
</m:Reports>
If i do like this nothing is shown in VS design. If i change the binding of the listbox to
<ListBox x:Name="ReportListBox" ItemsSource="{Binding}"
I can see the values in design. I realize why this is the case as the usercontrol is bound to the viewmodel at runtime. What i think i need for the designdata is something like this
<mc:ReportListViewModel xmlns:mc="clr-namespace:MYAPP.Modules.ReportList.ViewModels">
<m:Reports xmlns:m="clr-namespace:MYAPP.Modules.ReportList.Models">
<m:Report ReportName="Reportname 1" Id="AAAA-BBB-CCC" ></m:Report>
<m:Report ReportName="Reportname 2" Id="AAAA-BBB-CCC" ></m:Report>
</m:Reports>
</mc:ReportListViewModel>
</m:Reports>
But im getting the error. "The type 'ReportListViewModel' does not support direct content". Anyone has a solution