A dropdown editor to edit values of Enum type

Namespace: Dapfor.Net.Editors
Assembly: 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:

Examples

 Copy imageCopy
//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

See Also