Skip to content

SyncfusionExamples/How-to-disable-grouping-for-a-specific-scenario-dynamically

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

The .NET MAUI DataGrid allows you to disable grouping dynamically by clearing the GroupColumnDescriptions collection. Additionally, if you want to remove grouping when there's only one group, you can use the following code snippet. The code below illustrates how to dynamically disable grouping for a specific scenario.

C#
public MainPage()
{
   InitializeComponent();
   viewModel.InstalledModels.CollectionChanged += InstalledModels_CollectionChanged;
}

private void InstalledModels_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
   if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
   {
   	if (datagrid.View!.Groups.Count() == 1)
   	{
   		datagrid.GroupColumnDescriptions.Clear();
   	}
   }
}

Download the complete sample from GitHub

Conclusion

I hope you enjoyed learning how to disable grouping for a specific scenario dynamically. You can refer to our .NET MAUI DataGrid feature tour page to learn about its other groundbreaking features. Explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data. For current customers, check out our .NET MAUI components on the License and Downloads page. If you are new to Syncfusion®, try our 30-day free trial to explore our .NET MAUI DataGrid and other .NET MAUI components. Please let us know in the comments section if you have any queries or require clarification. You can also contact us through our support forums, Direct-Trac or feedback portal, or feedback portal. We are always happy to assist you!

About

This demo shows how to disable grouping for a specific scenario dynamically in .NET MAUI DataGrid (SfDataGrid)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages