Gets the edit in place settings.

Namespace: Dapfor.Net.Ui
Assembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)

Syntax

C#
public Grid..::..GridEditInPlace EditInPlace { get; }
Visual Basic
Public ReadOnly Property EditInPlace As Grid..::..GridEditInPlace
	Get
Visual C++
public:
property Grid..::..GridEditInPlace^ EditInPlace {
	Grid..::..GridEditInPlace^ get ();
}
F#
member EditInPlace : Grid..::..GridEditInPlace with get

Property Value

Type: Grid..::..GridEditInPlace
The Grid..::..GridEditInPlace settings.

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
//Example of an easy drop-down editor where the end-user can click on the push button
public class CustomEditor : UITypeEditor
{
    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
    {
        // Uses the IWindowsFormsEditorService to display a drop-down UI in the grid. (See more System.Drawing.Design.UITypeEditor)
        IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

        //The result to be returned
        object result = value;

        //Create some UI control
        Button button = new Button();
        button.Click += delegate
        {
            //result = ... <new value>
            service.CloseDropDown();
        };
        //Do edit in place in the editor service. If the end user clicks on the button, then the callback will be called.
        service.DropDownControl(button);

        return result;
    }

    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
    {
        //The style is drop-down list box
        return UITypeEditorEditStyle.DropDown;
    }
}


//Some data object
public class Car 
{
    //Some fields
    private double price;
    private double maxSpeed;
    private Color color;

    //Declaration of the CustomEditor. This declaration is also used by the System.Windows.Forms.PropertyGrid, so your object 
    //can be edited in the same way in various grids. 
    [Editor(typeof(CustomEditor), typeof(UITypeEditor))]
    public double MaxSpeed
    {
        get { return maxSpeed; }
        set { maxSpeed = value; }
    }

    //The declaration of the Editor can be done in the column
    public double Price
    {
        get { return price; }
        set { price = value; }
    }

    //Default color editor is used (System.Drawing.Design.ColorEditor). 
    //This editor is returned by the TypeDescriptor.GetEditor(typeof (Color), typeof (UITypeEditor)) call; 
    public Color Color
    {
        get { return color; }
        set { color = value; }
    }
}

//Initialize the grid
public void AddDataObjectToGrid(Grid grid)
{
    //Configure the headers
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("MaxSpeed"));
    grid.Headers[0].Add(new Column("Price"));
    grid.Headers[0].Add(new Column("Color"));

    grid.Headers[0]["MaxSpeed"].Editable = true;
    grid.Headers[0]["Price"].Editable = true;
    //Declare the editor only for the current grid
    grid.Headers[0]["Price"].Editor = new CustomEditor();
    grid.Headers[0]["Color"].Editable = true;

    //Add a data object
    grid.Rows.Add(new Car());

    //Edit the cell programmatically
    grid.Rows[0]["Price"].Edit();

    //...
}

See Also