Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since nobody has helped me, I found a solution by myself :)</p> <p>In fact there are two ways:<br/> 1) by using LoadingRowGroup event in DataGrid:</p> <pre><code> void dataGrid1_LoadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e) { e.RowGroupHeader.Template = (ControlTemplate)System.Windows.Markup.XamlReader.Load( @"&lt;ControlTemplate xmlns=""http://schemas.microsoft.com/client/2007""&gt; &lt;StackPanel Orientation=""Horizontal"" Background=""LightGray""&gt; &lt;TextBlock Text=""Name of group: "" HorizontalAlignment=""Left""/&gt; &lt;TextBlock Text=""{Binding Name}"" HorizontalAlignment=""Left""/&gt; &lt;/StackPanel&gt; &lt;/ControlTemplate&gt;"); } </code></pre> <p>2) By setting a Style of DataGridRowGroupHeader:</p> <pre><code> &lt;data:DataGrid.RowGroupHeaderStyles&gt; &lt;Style TargetType="data:DataGridRowGroupHeader"&gt; &lt;Setter Property="SublevelIndent" Value="0" /&gt; &lt;Setter Property="Height" Value="30" /&gt; &lt;Setter Property="IsEnabled" Value="false" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;StackPanel Orientation="Horizontal" Background="LightGray"&gt; &lt;TextBlock Text="Name of group: " HorizontalAlignment="Left"/&gt; &lt;TextBlock Text="{Binding Name}" HorizontalAlignment="Left"/&gt; &lt;/StackPanel&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/data:DataGrid.RowGroupHeaderStyles&gt; </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload