Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Need to display RowCount & Rowheader in Grouping

$
0
0
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>

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>