This project has moved. For the latest updates, please go here.

Need to display RowCount & Rowheader in Grouping

Jun 23, 2014 at 6:05 AM
Edited Jun 23, 2014 at 6:22 AM
Hi,
I need to display the Row item Count with the Header & the RowHeader within the expand result, is it possible to have it as in the attachment.Image
Developer
Jun 23, 2014 at 3:36 PM
Hi,

I believe you are using the DataGrid from the Xceed.Wpf.Toolkit.

1) To display the number of items in the group, you can define a DataTemplate for groups that displays in red the quantity of items.
2) To display the columnManagerRow in the publisher's groupConfiguration, you can redefine the groupConfiguration of this specific column.

Here's the XAML for the 2 modifications :
<Window.Resources>
      <DataTemplate x:Key="defaultGroupTemplate">
         <StackPanel Orientation="Horizontal"
                     VerticalAlignment="Center">
            <ContentPresenter Content="{Binding Value}"
                              ContentTemplate="{Binding RelativeSource={RelativeSource TemplatedParent},Path=DataContext.ValueTemplate}"
                              ContentTemplateSelector="{Binding RelativeSource={RelativeSource TemplatedParent},Path=DataContext.ValueTemplateSelector}"
                              VerticalAlignment="Center" />
            <TextBlock Text=" ("
                       Foreground="Red"
                       VerticalAlignment="Center" />
            <TextBlock Text="{Binding ItemCount}"
                       Foreground="Red"
                       VerticalAlignment="Center" />
            <TextBlock Text=")"
                       Foreground="Red"
                       VerticalAlignment="Center" />

         </StackPanel>
      </DataTemplate>

      <DataTemplate  DataType="{x:Type xcdg:Group}">
         <ContentControl x:Name="groupContentPresenter"
                         Focusable="False"
                         Content="{Binding}"
                         ContentTemplate="{StaticResource defaultGroupTemplate}" />
      </DataTemplate>

      <xcdg:GroupConfiguration x:Key="PublisherGroupConfiguration">
         <xcdg:GroupConfiguration.Headers>
            <DataTemplate>
               <xcdg:ColumnManagerRow />
            </DataTemplate>
         </xcdg:GroupConfiguration.Headers>
      </xcdg:GroupConfiguration>
   </Window.Resources>
    
   <Grid>
      <xcdg:DataGridControl x:Name="_datagrid">
         <xcdg:DataGridControl.Columns>
            <xcdg:Column FieldName="GameName"
                         IsMainColumn="True">
            </xcdg:Column>

            <xcdg:Column FieldName="Creator">
            </xcdg:Column>

            <xcdg:Column FieldName="Owner">
            </xcdg:Column>

            <xcdg:Column FieldName="Publisher"
                         GroupConfiguration="{StaticResource PublisherGroupConfiguration}">
            </xcdg:Column>
         </xcdg:DataGridControl.Columns>
      </xcdg:DataGridControl>
</Grid>
Jun 24, 2014 at 7:24 AM
Edited Jun 24, 2014 at 7:25 AM
Hi BoucherS,
Thanks for the reply. I'm using the ExtendedDataGrid dll from https://wpfextendeddatagrid.codeplex.com/..Will the same solution work in it?
Developer
Jun 25, 2014 at 12:24 PM
Hi mightyselva.
I don't use this other DataGrid. You can try it or ask the author of this datagrid.
Thanks.