PropertyGridControl.DefaultCollectionEditors Property
Provides access to the default editors for collections in the current PropertyGridControl.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
Declaration
Property Value
Type | Description |
---|---|
DevExpress.XtraVerticalGrid.PGridDefaultCollectionEditors | A DevExpress.XtraVerticalGrid.PGridDefaultCollectionEditors object that specifies the collection of the default editors for collections in the current PropertyGridControl. |
Remarks
By default, the PropertyGridControl automatically determines editors for properties based on their types. For instance, Boolean properties are edited using a ComboBoxEdit with the traditional True and False options. However, you can also associate a particular Type with a specific editor from the XtraEditors library using the PropertyGridControl.DefaultEditors property.
For collections, you can enable either the standard or DevExpress editors using the PropertyGridControl.OptionsCollectionEditor property.
If these approaches do not fit your needs, the DefaultCollectionEditors dictionary allows you to associate any custom editor with a particular type. This editor will be invoked with a click on the property’s ellipsis button in the PropertyGridControl. The DefaultCollectionEditors dictionary contains pairs of:
- keys that are Type objects specifying the types for which to provide editors;
- values that are delegates returning System.Drawing.Design.UITypeEditor objects corresponding to those types. The delegates accept the property type as a parameter.
The specified editors are used as default editors for properties of the corresponding types if they are not annotated with the System.ComponentModel.EditorAttribute.
The example below shows how to specify a default editor for a particular property type using the DefaultCollectionEditors dictionary.
propertyGridControl1.DefaultCollectionEditors.Add(typeof(List<MyType>), (t) => { return new System.ComponentModel.Design.CollectionEditor(t); });