Skip to main content

How to retain the text editing capability of a cell when the field is binded to a custom editor?

Comments

1 comment

  • Dapfor Team

    Dear Juno,

    You can use any control to edit cells. Please find an example demonstrating how to create and use the custom editor:

     

    class MyEditor : UITypeEditorEx
    {
        public override StopEditReason EditCell(IGridEditorService service, Cell cell, StartEditReason reason)
        {
            using(TextBox control = new TextBox())
            {
    //Setup control
    control.Text = cell.Text;
                control.BackColor = Color.BurlyWood;

                //control
                control.KeyDown += (sender, args) =>
                {
                    //Key is pressed here
                };

    //edit data in the control
                service.CellEditControl(control, cell.VirtualBounds, reason);

    //cell.Text = control.Text;
    // or
    //cell.Value = ...
            }
        }
    }

     

    Best regards,

    Dapfor

    0

Please sign in to leave a comment.

Powered by Zendesk