Hello,
Our users prefer a keyboard interface, so I have a few questions. Please consider a XAML solution before code-behind:
1. When navigating from an adjacent control to XamDataGrid, it seems that a cell must be active before I can tab into it and edit data. How could I make the first cell in the add row active by default?
2. What is a good way to tab from the end of add row to the next add row?
3. When an entire row has the focus, say after the row is selected, is there a way to use the keyboard to activate a cell within the active row? If not, is there a code solution for this?
4. Why is it that sometimes when I tab into a XamComboEditor is goes into edit mode, and other times I must press F2 for edit mode?
Thanks very much.
actually, you may disregard questions 2 and 4. For number 2, I believe a good way is to hit enter after data is entered in the new row, and another new row will be created into which I can tab. For 4, I may have been confusing the arrow with the tab (long day), when the tab seems to always launch the comboeditor. Thanks.
Hello Darryl,
Thank you for your post!
I have been looking into it. For your first requirement you can set the first cell of the AddNewRecord to be active, by using the following code: (e.OriginalSource as XamDataGrid).RecordManager.CurrentAddRecord.Cells[0].IsActive = true;. If you want to make it active when the application is started you can handle the InitializeRecord event and place the code snippet there.
For your third requirement I can suggest to handle the SelectedItemsChanged event of the XamDataGrid and place the following code snippet in it: ((sender as XamDataGrid).ActiveRecord as DataRecord).Cells[0].IsActive = true;. This way when the user selects a record, the first cell of this record would become active. Then after the enter key is pressed the cell would enter in edit mode.
Please do not hesitate to let me know if you have any further questions on this matter.
Thank you for the feedback. I am glad I was able to help. Please do not hesitate to let me know if you have any further questions on this matter.
XamDataGrid_InitializeTemplateAddRecord is an acceptable event to activate the add row even if the model collection is empty.
I've tried both Loaded and Initialize, but the RecordManager.CurrentAddRecord is null in both cases.
I have been looking into your post!
If the collection, that you bind to the xamDataGrd is empty I can suggest to use the Loaded event of the XamDataGrid.
Thank you Gergana. SelectedItemsChanged works fine, but InitializeRecord doesn't work if the collection is empty.