1
我将数据网格分组到两个级别。我的意思是每个主要组都有一个或多个子组。Wpf DataGrid子组风格
<controls:DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" Style="{DynamicResource newExpanderStyle}" HorizontalAlignment="Left"
Margin="5,0,0,0" VerticalAlignment="Top" Background="{DynamicResource NormalBrushGrid}" >
<Expander.Header>
<StackPanel Background="#E5E5E5" Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" FontWeight="Bold" FontSize="12" Margin="5,0" />
<TextBlock Text="{Binding Path=ItemCount}"/>
</StackPanel>
</Expander.Header>
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</controls:DataGrid.GroupStyle>
我想区分的子组从主group.How我可以预先
昌施加不同的颜色来分组头
感谢。
Msdn说你不能在XAML中设置这个属性。 – Hukam 2011-05-11 07:57:38
我没有尝试设置它,是吗? – 2011-05-19 23:21:00
请尝试让我知道:) – Hukam 2011-05-20 07:24:07