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.
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.
OK, Since nobody is willing to help out. I did the digging myself. Turned out I have to set the MaxHeight for the XamDataGrid for the CellValuePresenter to be created, and further enable the Edit Mode. I don't know why this is not a problem for Dialog window, maybe the container window's size limited the size of the grid, so the grid is automatically assigned a maxHeight?
Can someone give me a reasonable explanation? My problem is resolved, but I still like to get a good explanation.
Thanks.
Hello rzhu,
I have been looking through your posts and I tried to recreate your scenario on my side following your requirements. Please have a look at the attached sample, in it even when XamDataGrid is placed within the MainWindow the described approach works as expected. Would you please modify the attached sample in order to represent your issue so I can continue my investigation on this matter.
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.
Unfortunately I cannot make it happen in a simple case. The code that was having problem sits on a complicated framework we built using Prism and Unity framework. I actually tried to build my own test project and couldn't reproduce it. I know this is frustrating for you guys to debug. I was hoping that you guys can look into your source and see if you have any clue as why MaxHeight can cause this. If you need to test out any scenario, I can try it out in our code and let you know the results.
I contacted our developers on this matter, still they also can’t think of any reason for the strange behavior that you described. Still if you are able to create a simple sample that duplicates the issue we would be happy to take a look at it.