Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2116
Is there a way to get the grid to record updates made in code behind to the undo queue...
posted

I'm setting values using the cell.Value = method in code behind but its not getting recorded in the undo history.

  • 27093
    Verified Answer
    posted

    Hello,

     

    I have been investigating into your issue and even though there doesn't seem to be a built-in way to make the undo remember code behind changes, there is a way to simulate that this is done through the user input. In order to simulate that you need to start edit mode change the editor’s text and exit edit mode. If you are doing this in your CellActivated or CellChanged event you can do something like this:

     

    CellValuePresenter cvp = CellValuePresenter.FromCell(e.Cell);

    cvp.Editor.StartEditMode();

    cvp.Editor.Text = "99";

    cvp.Editor.EndEditMode(true, true);

     

    and that way the changes will be included in the undo queue.

     

    Please let me know if you require any further assistance on the matter.