Hi Michal Dziubek,
To trigger an event when a user adds or deletes a column in the grouping box
area of the SfDataGrid control, you can use the CollectionChanged
event of the GroupColumnDescriptions property. Here is an example code
snippet that demonstrates:
//Event Subscription
this.sfDataGrid1.GroupColumnDescriptions.CollectionChanged
+= OnGroupColumnDescriptionsCollectionChanged;
//Event customization
private void OnGroupColumnDescriptionsCollectionChanged(object sender,
System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
// Your event handling code goes here
Console.WriteLine("GroupColumnDescriptions CollectionChanged event is
triggered : " + e.Action.ToString());
}
|
Note that the CollectionChanged event is raised whenever the group column
descriptions collection changes, which includes adding or deleting columns as
well as moving them within the collection. You can use the Action
property of the e parameter passed to the event handler to determine the
specific action that triggered the event (e.g. Add, Remove,
etc.).
UG Link: https://help.syncfusion.com/windowsforms/datagrid/grouping
API Link: https://help.syncfusion.com/cr/windowsforms/Syncfusion.WinForms.DataGrid.GroupColumnDescriptions.html
Find the sample demo in the attachment.
Regards,
Vijayarasan S
If this post is helpful, please consider Accepting it as the
solution so that other members can locate it more quickly.
Attachment:
Sample_2ae221b5.zip