A dropdown editor to edit values of Enum type
Namespace: Dapfor.Net.EditorsAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public class EnumEditor : DropDownEditor |
Visual Basic |
---|
Public Class EnumEditor Inherits DropDownEditor |
Visual C++ |
---|
public ref class EnumEditor : public DropDownEditor |
F# |
---|
type EnumEditor = class inherit DropDownEditor end |
Remarks
To edit value in Cell, the data object must implement
the Set- property, and the Column must be editable. If this two conditions are true, then the Grid looks for the editor in the next order:
- In Column by calling the Editor property
- In IDataField by calling the Editor property. The editon can be specified with the EditorAttribute
- If the editor is not found, the Grid tries to retrive an editor from the PropertyDescriptor by calling the GetEditor(Type) method
- If the value is of the bool type, BoolEditor is used
- If the value is of the enum type, EnumEditor is used
- If the value implements IEnumerable interface, EnumerableEditor is used
- If the value implements IConvertible interface, ConvertibleValueEditor is used
Examples
Copy | |
---|---|
//A custom editor public class CustomEditor : UITypeEditor { //Implementation of the editor... (See more the System.Drawing.Design.UITypeEditor) } public class DataObject { //Declare some enum public enum DataFieldType { Double, Decimal, String, } private DataFieldType fieldType; //Public property. If the user wants to edit this field, the EnumEditor will be used public DataFieldType FieldType { get { return fieldType; } set { fieldType = value; } } } //Initialize the grid public void PopulateGrid(Grid grid) { //Configure the headers grid.Headers.Add(new Header()); grid.Headers[0].Add(new Column("FieldType")); grid.Headers[0]["FieldType"].Editable = true; grid.Headers[0]["FieldType"].Editor = new CustomEditor(); //Add a data object grid.Rows.Add(new DataObject()); } |
Inheritance Hierarchy
System..::..Object
System.Drawing.Design..::..UITypeEditor
Dapfor.Net.Editors..::..UITypeEditorEx
Dapfor.Net.Editors..::..DropDownEditor
Dapfor.Net.Editors..::..EnumEditor
System.Drawing.Design..::..UITypeEditor
Dapfor.Net.Editors..::..UITypeEditorEx
Dapfor.Net.Editors..::..DropDownEditor
Dapfor.Net.Editors..::..EnumEditor