PropertyGridControl.DefaultEditors Property
Specifies the collection of in-place editors used by default to represent row values of specific data types
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
Declaration
Property Value
Type | Description |
---|---|
DevExpress.XtraVerticalGrid.Rows.PGridDefaultEditors | A DevExpress.XtraVerticalGrid.Rows.PGridDefaultEditors collection which associates editors with specific data types. |
Remarks
By default, the Property Grid Control uses specific in-place editors to represent values of specific data types. For instance, Boolean properties are edited using a ComboBox editor with the traditional True and False options.
It’s possible, however, to specify which editors must be used to edit values of specific data types. To do this, you need to add an item to the DefaultEditors collection which will associate a specific data type with a specific repository item. A repository item is an object which corresponds to a specific editor from the XtraEditors library and stores the settings of this editor. For instance, a RepositoryItemCheckEdit object corresponds to a CheckEdit control.
So if you need to represent Boolean values in rows as check boxes, you must create a RepositoryItemCheckEdit object and associate it with the Boolean type via the DefaultEditors collection.
Editors from the DefaultEditors collection are only used if the VGridOptionsBehavior.UseDefaultEditorsCollection property is set to true (this is the default value).
Example
The following code creates a PropertyGridControl and makes it display its own properties.
By default, Boolean values are edited in the Property Grid Control using a ComboBox control with the True and False options. This example shows how to associate a CheckEdit control with the Boolean data type. As a result, the CheckEdit control will be used by default for editing Boolean values.
Firstly, a repository item (RepositoryItemCheckEdit) which corresponds to the CheckEdit control is created. Then it is associated with the Boolean type via the PropertyGridControl.DefaultEditors
collection.
The following image shows the result. Notice that the created repository item is customized to represent traditional check boxes as radio buttons.
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraEditors.Repository;
// ...
PropertyGridControl pGrid = new PropertyGridControl();
this.Controls.Add(pGrid);
pGrid.SelectedObject = pGrid;
pGrid.Dock = DockStyle.Fill;
// Create a repository item which represents an in-place CheckEdit control.
RepositoryItemCheckEdit riCheckEdit = new RepositoryItemCheckEdit();
// Represent check boxes as radio buttons.
riCheckEdit.CheckStyle = DevExpress.XtraEditors.Controls.CheckStyles.Radio;
// Associate the Boolean data type with the created repository item.
pGrid.DefaultEditors.Add(typeof(Boolean), riCheckEdit);