I have a XamTreeGrid with SelectionTypeRecord="Extended" and RecordSelectorLocation="None". When there are more rows than can be displayed and the user selects two or more rows and then scrolls the XamTreeGrid so that the selected records are not visible any longer, the selection is changed. When scrolling back and forth so the selected records are visible and then invisible the records will sometimes be selected and sometimes not. Is there a property that I have missed to configure or is there anything else I can do to solve this problem or is it a bug?
BR
Hilma Maria
Hi Andrew, I was too quick when answering you yesterday. I found a binding to DataRecordPresenter.IsSelected and when I changed this from the problem was resolved even when I removed RecordContainerGenerationMode="PreLoad" .
Thanks for your help!
Hello Hilma,
Thank you for your update.
Setting the CellClickAction to “SelectRecord” should select the record itself, which will reflect on the DataRecordPresenter without actually setting it there, as the DataRecordPresenter is bound to the Record’s IsSelected property.
I have put together a simple sample project to test the behavior you are seeing about the selection changing, but have been unable to reproduce it. I am attaching it here. It will be helpful if you can modify it such that it reproduces the behavior you are seeing, as that may help me to explain it to you further.
Regarding the 50-row maximum, this should not have too much of a performance issue, but I suppose it depends also on how many columns are in your XamTreeGrid as well. For example, if you have 50 rows, but something like 100 columns, the performance will still suffer.
Please let me know if you have any other questions or concerns on this matter.
XamTreeGridSelectionTest.zip
Hi Andrew,
I set the selection by clicking the rows/cells in the xamTreeGrid. I have set CellClickAction="SelectRecord". Where will this place my selection? The only time I set the selection in code is when I un-select rows and select a single one, so this is not causing the problem.
My users will not have more than maybe 50 rows maximum, will this cause bad perfirmance witt PreLoad set?
Thanks for your help
It should not be necessary to set the RecordContainerGenerationMode in this case to “PreLoad,” as this will shut off the virtualization of the grid. This will cause some potentially very bad performance if you have a large data source, as it will try to generate all of the visual elements of the grid at startup.
I am curious what you are currently setting selection on in the application where this issue is present? Are you setting selection on the DataRecordPresenter by chance? I ask, as this can cause the behavior because by default, the DataRecordPresenter is recycled and reused as you scroll, which can cause unwanted visual behaviors if you set properties on it directly. You should instead mark the underlying Record as selected by setting its IsSelected property to true or adding it to the XamTreeGrid.SelectedItems.Records collection.
Resolved this by setting RecordContainerGenerationMode="PreLoad"