DesignTime data not showing in Blend when bound against CollectionViewSource
Posted
by bitbonk
on Stack Overflow
See other posts from Stack Overflow
or by bitbonk
Published on 2009-09-19T06:35:33Z
Indexed on
2010/06/17
8:43 UTC
Read the original article
Hit count: 334
I have datatemplate for a viewmodel where an itemscontrol is bound again a CollectionViewSource (to enable sorting in xaml).
<DataTemplate x:Key="equipmentDataTemplate">
<Viewbox>
<Viewbox.Resources>
<CollectionViewSource x:Key="viewSource" Source="{Binding Modules}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="ID" Direction="Ascending"/>
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>
</Viewbox.Resources>
<ItemsControl ItemsSource="{Binding Source={StaticResource viewSource}}"
Height="{DynamicResource equipmentHeight}"
ItemTemplate="{StaticResource moduleDataTemplate}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Viewbox>
</DataTemplate>
I have also setup the UserControl where all of this is defined to provide designtime data
d:DataContext="{x:Static vm:DesignTimeHelper.Equipment}">
This is basically a static property that gives me an EquipmentViewModel that has a list of ModuleViewModels (Equipment.Modules). Now as long as I bind to the CollectionViewSource the designtime data does not show up in blend 3. When I bind to the ViewModel collection directly
<ItemsControl ItemsSource="{Binding Modules}"
I can see the designtime data. Any idea what I could do?
© Stack Overflow or respective owner