Использование Этот код надеется, что ваша проблема будет решена.
<sdk:DataGrid.RowGroupHeaderStyles>
<Style TargetType="sdk:DataGridRowGroupHeader">
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Background" Value="#FFE4E8EA" />
<Setter Property="Height" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="sdk:DataGridRowGroupHeader">
<sdk:DataGridFrozenGrid x:Name="Root"
Background="{TemplateBinding Background}">
<sdk:DataGridFrozenGrid.Resources>
<ControlTemplate x:Key="ToggleButtonTemplate"
TargetType="ToggleButton">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="CollapsedArrow"
Storyboard.TargetProperty="(Stroke).Color"
Duration="0" To="#FF6DBDD1"/>
<ColorAnimation Storyboard.TargetName="ExpandedArrow"
Storyboard.TargetProperty="(Fill).Color"
Duration="0" To="#FF6DBDD1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Storyboard.TargetName="CollapsedArrow"
Storyboard.TargetProperty="(Stroke).Color"
Duration="0" To="#FF6DBDD1"/>
<ColorAnimation Storyboard.TargetName="ExpandedArrow"
Storyboard.TargetProperty="(Fill).Color"
Duration="0" To="#FF6DBDD1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
Storyboard.TargetName="CollapsedArrow"
Storyboard.TargetProperty="Opacity" To=".5"/>
<DoubleAnimation Duration="0"
Storyboard.TargetName="ExpandedArrow"
Storyboard.TargetProperty="Opacity" To=".5"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked" />
<VisualState x:Name="Unchecked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetName="CollapsedArrow"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"
Value="Visible"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Duration="0"
Storyboard.TargetName="ExpandedArrow"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Path Stretch="Uniform"
Data="F1 M 0,0 L 0,1 L .6,.5 L 0,0 Z"
Width="5" HorizontalAlignment="Center"
VerticalAlignment="Center" x:Name="CollapsedArrow"
Visibility="Collapsed" Stroke="#FF414345"/>
<Path Stretch="Uniform"
Data="F1 M 0,1 L 1,1 L 1,0 L 0,1 Z" Width="6"
HorizontalAlignment="Center" VerticalAlignment="Center"
x:Name="ExpandedArrow" Fill="#FF414345"/>
</Grid>
</ControlTemplate>
</sdk:DataGridFrozenGrid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CurrentStates">
<VisualState x:Name="Regular"/>
<VisualState x:Name="Current">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisual"
Storyboard.TargetProperty="Opacity"
To="1" Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<sdk:DataGridFrozenGrid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition/>
</sdk:DataGridFrozenGrid.ColumnDefinitions>
<sdk:DataGridFrozenGrid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</sdk:DataGridFrozenGrid.RowDefinitions>
<Rectangle Grid.Column="1" Grid.ColumnSpan="5" Fill="#FFFFFFFF" Height="1"/>
<Rectangle Grid.Column="1" Grid.Row="1" x:Name="IndentSpacer" />
<ToggleButton Grid.Column="2" Grid.Row="1" x:Name="ExpanderButton"
Height="15" Width="15" IsTabStop="False"
Template="{StaticResource ToggleButtonTemplate}" Margin="2,0,0,0"/>
<!-- This is START of the First Group Header of the DataGrid -->
<!--<StackPanel Grid.Column="3" Grid.Row="1" Orientation="Horizontal"
VerticalAlignment="Center" Margin="0,1,0,1"
Visibility="{Binding Width, ElementName=IndentSpacer}">
<TextBlock Margin="4,0,0,0" Text="{Binding Name}" Foreground="Red"/>
</StackPanel>-->
<!-- This is END of the First Group Header of the DataGrid -->
<!-- This is START of the Second Group Header of the DataGrid -->
<Grid Grid.Column="3" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,1,0,1"
Visibility="{Binding Width, ElementName=IndentSpacer}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<!--<ComboBox Margin="4,0,0,0" Width="120" ItemsSource="{Binding ItemsSource,ElementName=personDataGrid,Converter={StaticResource ConvToComboBox}}" DisplayMemberPath="text" SelectionChanged="comboSelectionChangeda"/>
<Button Margin="169,0,0,0" Height="15" Name="btn" Content="+" FontSize="9" Foreground="Black" FontWeight="Bold" Click="btn_Click"/>-->
<sdk:Label Content="{Binding ItemsSource,ElementName=personDataGrid,Converter={StaticResource ConvToGender}}"/>
</StackPanel>
</Grid>
<!-- This is END of Second Group Header of the DataGrid -->
<Rectangle Grid.Column="1" Grid.ColumnSpan="5" Fill="#FFD3D3D3" Height="1" Grid.Row="2"/>
<Rectangle x:Name="FocusVisual" Grid.Column="1" Grid.ColumnSpan="4" Grid.RowSpan="3"
Stroke="#FF6DBDD1" StrokeThickness="1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
IsHitTestVisible="false" Opacity="0" />
<sdk:DataGridRowHeader x:Name="RowHeader" Grid.RowSpan="3" sdk:DataGridFrozenGrid.IsFrozen="True"/>
</sdk:DataGridFrozenGrid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</sdk:DataGrid.RowGroupHeaderStyles>
Вот класс Converter, который возвращает настраиваемый заголовок группы
открытый класс GenderConv: IValueConverter {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
PagedCollectionView pageView = value as PagedCollectionView;
Person person = pageView.CurrentItem as Person;
string gender = person.Gender.ToString();
return "Sex:"+ gender;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}