This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi there, If there are some cells in the DataGrid is read only by setting
and some cell is editable. When the editable cell is just before the cell that is read only, you focus on the editable cell, press tab key, the focus will be out of the DataGrid instead of going to next cell. Thanks, Gordon |
|
|
Hello Gordon Unfortunately I have not been able to reproduce this issue. I've tried various combinations of options that I thought would affect this, but the tab functionality still works fine in this scenario. The most likely cause is that the default WPF tab functionality is somehow overriding the DataGrid tab functionality we implemented which as a result gives focus to the next control outside the DataGrid - but I was unable to even reproduce this. If you are able to work out what needs to be done to cause this issue, let me know and I'll have another go at solving this. -Jason Fauchelle |
|
|
Hi Jason, If the editable cell is using DoubleTextbox for editing template, and other reaonly cell using TextBlock as display template, can you reproduce it? Thanks, Gordon |
|
|
Hello Gordon No, unfortunately this did not help. Here is some information about the code that may help you debug this at your end: The Tab key causes the HighlightRightWithWrapping_Executed method to be called which is at line 714 of the DataGrid. This then calls the HighlightNext method which is where the bulk of the logic is. Place some break points to see that these methods are being called in this scenario and that they are functioning as expected. Let me know if you find anything that will help us reproduce this. -Jason Fauchelle |
|
|
Hi Jason, Here is more information. You can change the value of editable cell, then press "tab" key, it will go to next read only cell. Since this cell is read only, if you press "tab" key again, it will comes out of the datagrid and goes to the menu item on the window. And it will not go through the line 714 anymore. Hope this will help. Gordon |
|
|
Hello Gordon Thanks, this helps a little, but was not enough to reproduce or solve. When pressing tab causes the focus to jump outside the DataGrid, does this method get called: HighlightRightWithWrapping_CanExecute ? If not, then it seems that the DataGrid may somehow be losing focus in some way, and so the default WPF Tab navigation is taking over. If this method is hit, then there may be some faulty logic in the CanExecure method. It may be that the Focus statement at line 1021 is being called but not working correctly - feel free to check this. I've seen this kind of issue in other projects, but not sure what would cause this in your project. After you respond to this, I should be able to come up with a solution. -Jason Fauchelle |
|
|
Hi Jason, From read only cell out of the datagrid, line 1021 (Focus();)never get called. But AttemptToSwitchHighlightedCellToEditMode() get called. But since the read only cell will not have editing mode at the moment, this function should not be called. So Maybe line 1015 has problem? You may also need to check if highlightedCell.IsEditing or HighlightedCellContainer.IsEditing? I change the code to the following and it seemed working:
|
|
|
Thanks Gordon This looks promising but I'll to test it around a bit. I'll work on this early next week. -Jason Fauchelle |
|
|
Hello Gordon In the next nightly build, line 1021 (Focus) should be reached in your scenario which should resolve the overall problem. Let me know how it goes. -Jason Fauchelle |
|
|
Thanks, Jason. It is fixed Gordon |
|