Hi,
I've configured the XamDataGrid to have a Group By Area at the top and collapsed by default. When a user tries to remove a field by dragging it out of the grid, because the field got dragged over the Group By Area expander, the Group By Area got expanded. Is there a way to disable that auto-expansion behavior?
Thanks,
Harold
Hello Harold,
Thank you for the grouping details you have provided.
When the GroupByArea is visible and present, in order to disable the expansion behavior, you can handle the Expanded event of the GroupByAreaMulti element by setting its IsExpanded property to false.
private void dataGrid_Loaded(object sender, RoutedEventArgs e){ dataGrid.GroupByAreaMulti.Expanded += (se, ev) => { (se as GroupByAreaMulti).IsExpanded = false; };}
In order to disable the grouping functionality of the XamDataGrid, you can set the FieldSettings.AllowGroupBy property of the XamDataGrid to false.
dataGrid.FieldSettings.AllowGroupBy = false;
I have attached a sample application that demonstrates the approach from above.
If you have any questions, please let me know.
Hi Tacho,
Thanks for the quick response. But your solution is not what I'm looking for. I want to see if there's a way to not expand the group by area when a field is dragged over the group by area. I still want to be able to expand the group by area by clicking on the expander. The Expanded event handler you suggested will simply not allow the group by area to be expanded.