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
675
Why is CellValuePresenter not created for AddNewRecord?
posted

Hi, There

I have a view that contains a xamDataGrid, and I'm running into a very strange problem. Here's the way I'm using this view.

  1. The view containing xamDataGrid is used in 2 ways, once contained in another view to be displayed in the main window. The other time is to be wrapped in a model window to be displayed as a dialog window.
  2. I'm listening to the CellActivated event (among other event handlers). When user reaches the last cell of the AddNewRecord, I automatically move the the next row by ExecuteCommand(CellNextByTab). This triggers the save of the new record, and a new AddNewRecord is created, and focus moved to the first cell of the newly created AddNewRecord.
  3. I then ExecuteCommand(StartEditMode) (still within the same CellActivated event handler) to get into edit mode.

The strange thing is that for the Dialog window, the code works fine. I was able to tab through the fields, move on to new record, and keep entering data. However, for the scenario where my view is embedded in the main window, the StartEditMode doesn't work. The code still sends the focus to the correct cell in the new AddNewRecord, but the cell is not in Edit mode. I have to manually click on the cell to enter edit mode.

To debug the issue, I added a line to retrieve the CellValuePresenter for the activeCell (CellValuePresenter.FromCell(e.cell)). What I found was that for the Dialog scenario, when I get to the cell in the new AddNewRecord, a value CellValuePresenter is already created. But for the Main window scenario, the there's nothing, the FromCell() returned null.

Any idea on why this is happening? How can I further debug this issue?

Thanks in advance.

 

Parents Reply Children