Edit this page

ToolBar

RadPropertyGrid offers a toolbar with out of the box functionality, which appears on the top of the control. This toolbar contains predefined functions to sort the items, to group the items or to filter them by a string entered in the text box. You can enable this tool bar by setting the ToolBarVisible property to true:

Enabling the Toolbar

radPropertyGrid1.ToolbarVisible = true;

RadPropertyGrid1.ToolbarVisible = True

Figure 1: RadPropertyGrid Toolbar

propertygrid-features-toolbar 001

You can set the predefined filter operator and property by making use of the following properties:

Customizing Default Filtering

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

RadPropertyGrid1.PropertyGridElement.ToolbarElement.FilterOperator = FilterOperator.Contains
RadPropertyGrid1.PropertyGridElement.ToolbarElement.FilterPropertyName = "Name"

The toolbar consists of a StackLayoutPanel, which allow you to easily add additional elements or modify the existing once. You can access the existing items as follows:

Accessing Toolbar Elements

RadTextBoxElement filterTextBox = radPropertyGrid1.PropertyGridElement.ToolbarElement.SearchTextBoxElement;
RadToggleButtonElement sortButton = radPropertyGrid1.PropertyGridElement.ToolbarElement.AlphabeticalToggleButton;
RadToggleButtonElement groupButton = radPropertyGrid1.PropertyGridElement.ToolbarElement.CategorizedToggleButton;

Dim filterTextBox As RadTextBoxElement = RadPropertyGrid1.PropertyGridElement.ToolbarElement.SearchTextBoxElement
Dim sortButton As RadToggleButtonElement = RadPropertyGrid1.PropertyGridElement.ToolbarElement.AlphabeticalToggleButton
Dim groupButton As RadToggleButtonElement = RadPropertyGrid1.PropertyGridElement.ToolbarElement.CategorizedToggleButton

If you want to add a new element in the toolbar, just add it to the Children collection of ToolbarElement:

Add Element to Toolbar

Figure 2: RadPropertyGrid Toolbar

propertygrid-features-toolbar 002

RadButtonElement clearFiltering = new RadButtonElement();
clearFiltering.Text = "Clear";
clearFiltering.MinSize = new System.Drawing.Size(25, 22);
clearFiltering.StretchHorizontally = false;
radPropertyGrid1.PropertyGridElement.ToolbarElement.Children.Add(clearFiltering);

Dim clearFiltering As New RadButtonElement()
clearFiltering.Text = "Clear"
clearFiltering.MinSize = New System.Drawing.Size(25, 22)
clearFiltering.StretchHorizontally = False
RadPropertyGrid1.PropertyGridElement.ToolbarElement.Children.Add(clearFiltering)

See Also