Since nobody has helped me, I found a solution by myself :)
In fact there are two ways:
1) by using LoadingRowGroup event in DataGrid:
void dataGrid1_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e)
{
e.RowGroupHeader.Template = (ControlTemplate)System.Windows.Markup.XamlReader.Load(
@"<ControlTemplate xmlns=""http://schemas.microsoft.com/client/2007"">
<StackPanel Orientation=""Horizontal"" Background=""LightGray"">
<TextBlock Text=""Name of group: "" HorizontalAlignment=""Left""/>
<TextBlock Text=""{Binding Name}"" HorizontalAlignment=""Left""/>
</StackPanel>
</ControlTemplate>");
}
2) By setting a Style of DataGridRowGroupHeader:
<data:DataGrid.RowGroupHeaderStyles>
<Style TargetType="data:DataGridRowGroupHeader">
<Setter Property="SublevelIndent" Value="0" />
<Setter Property="Height" Value="30" />
<Setter Property="IsEnabled" Value="false" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<StackPanel Orientation="Horizontal" Background="LightGray">
<TextBlock Text="Name of group: " HorizontalAlignment="Left"/>
<TextBlock Text="{Binding Name}" HorizontalAlignment="Left"/>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</data:DataGrid.RowGroupHeaderStyles>
The (2) way is better for static elements. But the first one can be used when you want to generate headers in a more dynamic way.