$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
Windows Forms PropertyGrid Control
Easily process properties of data objects, automatically generate and display custom data in C#.
Home > WinForms UI Controls > User Manual > Grouping Property Grid in C#

PropertyGrid Grouping in C#.NET

KetticPropertyGrid control for Windows Forms includes various features for data processing, including grouping, sorting, and filtering. The grouping functionality can be easily added to your Windows Forms application by using the PropertyGrid control. There are two different approaches allow the users to group the displayed items in PropertyGrid, grouping properties based on Category attribute through predefined grouping capability or grouping properties by defining GroupDescriptors using C# code.

Predefined Grouping Capability through Category Attribute

KetticPropertyGrid provides predefined grouping capability to group properties in property grid. The end users are able to call the predefined grouping through clicking the group button in the tool bar or changing the PropertuSort property to Categorized or CategorizedAlphabetical using C# code. The Categorized setting will group the properties based on the Category attribute and display the properties as enlisted in the object. And the CategorizedAlphabetical setting will group the properties based on the Category attribute and display the properties in alphabetical.

Customize Sorting Order in C# code

It is possible to adjust the sorting order by changing the SortOrder property using C# code. The following is the example that changing the category sorting by descending alphabetical.

ketticPropertyGrid1.PropertySort = PropertySort.CategorizedAlphabetical;
ketticPropertyGrid1.SortOrder = SortOrder.Descending;

Grouping Properties Manually in C#.NET Projects

To add grouping functionality to PropertyGrid, we must enable the EnableGrouping property by changing its value to true. And then we can add the desired GroupDescriptor to the GroupDescriptors collection of the KetticPropertyGrid. The following are the standards for filtering in PropertyGrid.
  • Category, the property is assigned from the Category attribute name in PropertyGrid
  • Value, the property allows the users to filter through property value in PropertyGrid
  • FormattedValue, this property is used to convert the property value to string in PropertyGrid
  • Name, the property allows the users to filter through property name in PropertyGrid
  • Label, it allows the users to change the filtering criteria by setting the Label property of the item
  • Description, the property can be controlled by the property Description attribute
  • OriginalValue, this property determines the value used while initializing the property

C# code for Adding a Group Descriptor


ketticPropertyGrid1.EnableGrouping = true;
GroupDescriptor group = new GroupDescriptor(new SortDescriptor[] { new SortDescriptor("FormattedValue", ListSortDirection.Ascending) });
ketticPropertyGrid1.GroupDescriptors.Add(group);
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls