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

PropertyGrid Toolbar in C#.NET

KetticPropertyGrid WinForms control allows the users to add a toolbar with out of the box functionality and then display the tool bar on the top of the PropertyGrid control. With the predefined functions in the toolbar, we are able to sort items, group items, as well as filter the items by entering a string into the text box. To enable the toolbar in PropertyGrid control, we need to change the value of the ToolBarVisible property to true. This article will discuss how to use the toolbar using C# code in PropertyGrid for Windows applications.

Enable Tool Bar in C# for PropertyGrid Control

To enable the toolbar in PropertyGrid control, we need to change the value of the ToolBarVisible property to true.

ketticPropertyGrid1.ToolbarVisible = true;

Customize Filtering using C# code in PropertyGrid

KetticPropertyGrid control supports the customization of the predefined filter operator and property. The C# code below demonstrates how to customize the filtering by setting the properties.

ketticPropertyGrid1.PropertyGridElement.ToolbarElement.FilterOperator = FilterOperator.Contains;
ketticPropertyGrid1.PropertyGridElement.ToolbarElement.FilterPropertyName = "Name";

Access Toolbar Elements using C# in PropertyGrid

KetticPropertyGrid allows the users to add or change elements in tool bar using C# code. This is achieved by using the StackLayoutPanel. The C# code below demonstrates how to access toolbar elements

KetticTextBoxElement filterTextBox = ketticPropertyGrid1.PropertyGridElement.ToolbarElement.SearchTextBoxElement;
KetticToggleButtonElement sortButton = ketticPropertyGrid1.PropertyGridElement.ToolbarElement.AlphabeticalToggleButton;
KetticToggleButtonElement groupButton = ketticPropertyGrid1.PropertyGridElement.ToolbarElement.CategorizedToggleButton;
To add a new element to the toolbar, we should add the element to the Children collection of ToolbarElement. The C# code below shows how to add element to toolbar.

KetticButtonElement clearFiltering = new KetticButtonElement();
clearFiltering.Text = "Clear";
clearFiltering.MinSize = new System.Drawing.Size(20, 16);
clearFiltering.StretchHorizontally = false;
ketticPropertyGrid1.PropertyGridElement.ToolbarElement.Children.Add(clearFiltering);
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