Hi there,
I use the XamDataGrid just for displaying bound data in a MVVM environment.My ViewModel just knows the source records, but not the order or groups in which the user sees them. All data manipulations are made in the ViewModel and the VM need to set the selected record in his list.
Now I have the problem, that e.g. if the user deletes a specific record, I want to set the logical next record as active but i don't know which record is the next.I would raise an event telling the View to select first/last/previous/next record to be set as active.
Is there a way the View could get the first/last/previous/next record for a given one, even if there are groups.
The previous record would be the the first record above the active one, like the use would open all groups upwards and then go down to the last child.
The next record would be the record in the same level or if is the last one in a group, open recursively the following groups until a datarecord is found.
In the same manner the first/last record could be found.
Are there any existing methods to get first/last/next/previous records? If not, will they come in one of the next versions?
Best regardscew3
Hi Stefan,
I tried using the advised commands and stuck with a problem.If the records are grouped it is not possible to jump to the last record.For reproducing my problem you can use the Samples Browser (xamDataGrid -> Editing and Selection -> Commands)
1. Group e.g. by Team
2. Click on "Record Last Overall" -> nothing happens
3. Click on "Record Last Displayed" -> nothing happens
How can I navigate via code to the first, last or any other record that is within a collapsed group?
Bestcew3
Hello,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Thank you!
Best regards,cew3
I have been looking into your post and I can say that VisbileIndex is correct, because the XamDataGrids takes into account the AddNewRecord and FilterRecord, which also has VisibleIndex Proeprties. As for the DataPresenterCommands, you can add a check if the ActiveRecord is not a DataRecord (xamDataGrid1.ActiveRecord.IsDataRecord) and if it is GroupByRecord you can expand to the same NestingDepth as the previously ActiveRecord and select the last/first one.
Hope this helps you.
thanks for the answer. I had a look at the commands but they don't fit my requests. I want to jump directly to the next displayable DataRecord, even if all it's parents are collapsed. If you use the command "RecordAbove" the grid will position on the above record, even it it's not a DataRecord. The command doesn't select the above DataRecord, which is a child of an collapsed GroupByRecord.During working with properties like ParentRecord I found a bug in VisibleIndex: The VisibleIndex starts with"1" for root GroupByRecord's. Nestes groups are indexed starting with "0".
To test this, just group some columns and walk upwards to to root. You will see that the VisibleIndex is correct if you don't have a node with NestingDepth == 0.