Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1890
Setting Selected Records
posted

I have a scenerio where the user will select records in the datagrid and click a button which will refresh the datarid and add more records. When the user refreshes the datagrid I need to reselect the records. I was able to implement it using a converter to do this. When I click a record the selections are gone however once I scroll up and down ths datagrid the selections reappear. The converter is triggered when I scroll up and down the datagrid. Is there a way to stop the converter from reselecting on scrolling?

Attached is a sample project to demostrate

PreSelectRecords.zip
Parents
  • 35319
    posted

    Hello,

     

    Thank you for your post. I am not sure that using converter is the best approach. By default when you reset the data source property on the xamDataGrid to a different data source, all the previous Record instances get discarded and new ones get created. That's why simply saving the selected records and restoring them in the selected collection will not work. One way you can however do this is you can save some unique id's of the records that are selected and then after resetting the data source, find the records in the xamDataGrid with those id's and set their IsSelected property. This would effectively restore selected records.

     

    Let me know if you need any further assistance on this matter.

Reply Children