'Declaration Public Structure GroupHeaderFooterItem Inherits System.ValueType
'Usage Dim instance As GroupHeaderFooterItem
public struct GroupHeaderFooterItem : System.ValueType
'Declaration Public Structure GroupHeaderFooterItem Inherits System.ValueType
'Usage Dim instance As GroupHeaderFooterItem
public struct GroupHeaderFooterItem : System.ValueType
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> <Grid.Resources> <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" Source="{Binding Source={x:Static Application.Current}, Path=Orders}"> <xcdg:DataGridCollectionViewSource.GroupDescriptions> <xcdg:DataGridGroupDescription PropertyName="ShipCountry"/> <xcdg:DataGridGroupDescription PropertyName="ShipCity"/> </xcdg:DataGridCollectionViewSource.GroupDescriptions> </xcdg:DataGridCollectionViewSource> <Style TargetType="{x:Type xcdg:GroupHeaderControl}"> <EventSetter Event="PreviewMouseLeftButtonDown" Handler="SelectRows"/> </Style> </Grid.Resources> <xcdg:DataGridControl x:Name="OrdersGrid" ItemsSource="{Binding Source={StaticResource cvs_orders}}"/> </Grid>
Private Sub SelectRows( ByVal sender As Object, ByVal e As MouseEventArgs ) Dim groupHeaderControl As GroupHeaderControl = TryCast( sender, GroupHeaderControl ); If groupHeaderControl Is Nothing Then Return; End If Dim context As DataGridContext = DataGridControl.GetDataGridContext( groupHeaderControl ) Dim header As GroupHeaderFooterItem = TryCast( context.GetItemFromContainer( grouHeaderControl, GroupHeaderFooterItem ) If Not header.Equals( GroupHeaderFooterItem.Empty ) Then Dim group As CollectionViewGroup = context.GetParentGroupFromItem( header ) If Not group Is Nothing Then For Each item As Object In group.Items If Typeof item Is CollectionViewGroup Then Me.SelectRecurse( context, CType( item, CollectionViewGroup ) ) Else context.SelectedItems.Add( item ) End If Next item End If End If End Sub Private Sub SelectRecurse( ByVal context As DataGridContext, ByVal group As CollectionViewGroup ) For Each item As Object In group.Items If Typeof item Is CollectionViewGroup Then Me.SelectRecurse( context, CType( item, CollectionViewGroup ) ) Else context.SelectedItems.Add( item ) End If Next item End Sub
private void SelectRows( object sender, MouseEventArgs e ) { GroupHeaderControl groupHeaderControl = sender as GroupHeaderControl; if( groupHeaderControl == null ) return; DataGridContext context = DataGridControl.GetDataGridContext( groupHeaderControl ); GroupHeaderFooterItem header = ( GroupHeaderFooterItem )context.GetItemFromContainer( groupHeaderControl ); if( !header.Equals( GroupHeaderFooterItem.Empty ) ) { CollectionViewGroup group = context.GetParentGroupFromItem( header ); if( group != null ) { foreach( object item in group.Items ) { if( item is CollectionViewGroup ) { this.SelectRecurse( context, ( CollectionViewGroup )item ); } else { context.SelectedItems.Add( item ); } } } } } private void SelectRecurse( DataGridContext context, CollectionViewGroup group ) { foreach( object item in group.Items ) { if( item is CollectionViewGroup ) { this.SelectRecurse( context, ( CollectionViewGroup )item ); } else { context.SelectedItems.Add( item ); } } } Language Filtered Section CS
System.Object
System.ValueType
Xceed.Wpf.DataGrid.GroupHeaderFooterItem
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2