' This method will handle the GroupAdded events that are raised. Private Sub grid_GroupAdded( ByVal sender As Object, _ ByVal e As GroupAddedEventArgs) Try e.Group.FooterRows.Add( New TextRow( "This group contains " + _ e.Group.GetSortedDataRowCount().ToString() + _ " rows." ) ) Catch exception As Exception MessageBox.Show( exception.ToString() ) End Try End Sub
' If you no longer wish to handle the GroupAdded events that are raised, ' you can unsubscribe from the event notification by doing the following: RemoveHandler grid.GroupAdded, AddressOf Me.grid_GroupAdded
C#
Copy Code
using Xceed.Grid; gridControl1.GroupAdded += new GroupAddedEventHandler( grid_GroupAdded ); // This method will handle the GroupAdded events that are raised. private void grid_GroupAdded( object sender, GroupAddedEventArgs e ) { try { e.Group.FooterRows.Add( new TextRow( "This group contains " + _ e.Group.GetSortedDataRowCount().ToString() + _ " rows." ) ); } catch( Exception exception ) { MessageBox.Show( exception.ToString() ); } } // If you no longer wish to handle the GroupAdded events that are raised, //you can unsubscribe from the event notification by doing the following: gridControl1.GroupAdded -= new GroupAddedEventHandler( grid_GroupAdded );