我有一个简单的mahapps metro数据网格,有6列 . 我在数据网格中填充了大约500行数据,并尝试按列 Headers 进行分组 . 除了分组工作,计算机CPU使用率高达99%,除了关闭应用程序之外我无法做其他事情 .
以下是用于datagrid的分组模板 . 我不确定它是扩展器控件还是数据网格本身是错误的?有任何想法吗?
我应该指定cpu使用率只有在我尝试扩展datagrid中的组时才会上升(Grpahic渲染问题?) . 默认情况下我让他们崩溃了 . 这也发生在没有额外的样式或teplates应用于datagrid或列 .
<DataGrid.GroupStyle>
<!-- Style for groups at top level. -->
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander IsExpanded="false">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Bottom" FontSize="13" FontWeight="Bold" Foreground="Ghostwhite" Text="{Binding Name}" />
<TextBlock Margin="10,0,0,0" VerticalAlignment="Bottom" FontSize="13" FontStyle="Italic" FontWeight="Bold" Foreground="Green" Text="{Binding ItemCount}" />
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>