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