The behaviour of the Grid differs if i set the ActiveRow programatically with a bound ViewModel or if i click on the row in the UI. If the row is activated by the ViewModel it's not possible to select more rows with SHIFT and clicking on another row. Then just the other row gets selected. I guess this happens because the ActiveRow is not focused correctly.
How can i set the focus on the ActiveRow?
Any help is apreciated :-)
Hello Christian,
Thank you for your post.
The behavior that you are currently seeing is expected. When setting the Active row of one of our grid controls, this doesn't necessarily mean that it is selected. Active is simply another type of state for a particular record in the XamDataGrid. Active is a kind of designation used for the "focused" record , but just because a record is active, doesn't necessarily mean it is selected. There can also only ever be a single active record in the XamDataGrid. For example, if you were to select multiple records in the XamDataGrid, you would see that the "active" one would be the last one you clicked, but there would be multiple selected ones.
To select your record in the XamDataGrid, there are a few things you can do. You can obtain the item that your record represents from your desired selected record's DataItem property and set it as the SelectedDataItem property of the grid, for one thing. You can also simply add the record to the XamDataGrid.SelectedItems.Records collection. After doing this, you should see the Shift+Click work to select multiple rows in the XamDataGrid.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hello Andrew,
Thank you for your answer! In our situation, the Active row is selected as well. I use the SelectedDataItems property which is bound to the view model.
In the view model the DataItem which should be selected is contained in the object[] of the bound property. After changing the selection in the view model and fireing the property changed event, the selection in in the grid is updated as expected. But, as i wrote in the first post, the selection cannot be extended by SHIFT+Clicking on another row.
So i still don't have any idea how to fix this problem.
Sincerely,
Christian
Using the additional details that you had added to this forum thread, I was able to reproduce this issue that you are seeing. This issue appears to be an issue with the XamDataGrid, and not so much with the focusing of the ActiveRecord at the start. I have tried to programmatically focus (and keyboard-focus) the initially active and selected record, but although this initial record is focused, it does not appear that the multiple selection works.
This behavior is unexpected, and as such I have asked our engineering staff to examine it a bit further. To ensure this behavior receives attention, I have logged it in our internal tracking systems with a development ID of 220043. I have also created a support case on your behalf so that you can track this development issue. This support case has an ID of CAS-173445-P2C2Y2 and you can access it here: https://www.infragistics.com/my-account/support-activity.
Thank you for your help! I will track the issue and hope it will be fixed soon :-)
Sincerely