I want to use ItemsControl
and bind datagrid rows to this, but it is not working and not draw items.
for example this code is working:
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander x:Name="exp" Style="{DynamicResource ExpanderGroupStyle}" IsExpanded="{Binding Name.IsExpanded}">
<Expander.Header>
<TextBlock Text="{Binding Name.Name}" />
</Expander.Header>
<ItemsPresenter/>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
but this code is not working and drawing data this code is very fast. (I want to use VirtualizingStackPanel
):
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander x:Name="exp" Style="{DynamicResource ExpanderGroupStyle}" IsExpanded="{Binding Name.IsExpanded}">
<Expander.Header>
<TextBlock Text="{Binding Name.Name}" />
</Expander.Header>
<ItemsControl ItemsSource="{Binding Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel >
</VirtualizingStackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Mode=OneWay}"/>
<!--<ItemsPresenter/>-->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
if I use ItemsPresenter
in code this is not draw data...