Cell edit event flow

ReoGrid performs the following cell edit flow:


When user pressed F2 or inputted any characters (including inputted from IME tool), ReoGrid will stop other processes and change operation status to Edit mode, before preparing the input field on screen ReoGrid will invoke the BeforeCellEdit event. This event provides the argument IsCanncelled which is used to cancel the edit operation. If edit is allowed, an input field will be displayed on screen and the focus will be transformed onto it.

During user inputting any text in the input field, ReoGrid will invoke the CellEditTextChanging and CellEditCharInputted event, the CellEditTextChanging event is raised when user changed the text in the field, it doesn’t care about how the text is inputted, such as direct input, copy/paste or in other ways. CellEditCharInputted event is raised when any characters received from user, including Unicode character from IME tool, this event provides the arguments allow that user code to change the input characters or disable characters to be received.

In WPF edition, CellEditCharInputted event can check a inputted character but cannot modify it,  to modify text consider to use CellEditTextChanging instead.

After user pressing ‘Enter’ key or moved focus out from the input field, the edit process will be terminated. The events AfterCellEdit and CellDataChanged will be invoked after edit operation is finished. Notice that when user pressed ‘Escape’ key the edit operation will be cancelled by ReoGrid and the data user inputted will be restore to the data before editing, the AfterCellEdit will be invoked but CellDataChanged will not.

AfterCellEdit vs. CellDataChanged

AfterCellEdit provides the chance to abort or cancel the edit operation even user has finished the inputting. Return the EndReason as Cancel from AfterCellEditEventArgs will cause the edit operation to be aborted, the data will be restore to the data before start edit. The CellDataChanged event is raised when data is changed in any way, including call method SetCellData and pasted from Clipboard, it is the final change to observe and change the cell data, it doesn’t provide the ability to cancel the change operation.