I have a xamdatagrid that uses checkboxes for multi-selections. I can get it to work however whenever the user will click the scrollbar or filter the selected items disappear. Is there a way I can preserve the selected items? Or has there been a fix for it yet?
Yes, the only way I can see this working looping thru each selected cell item and if the user clicks select all for 10,000 records that may take a long time to finish. Would you be able to provide a code snippet?
Hi dvickerie,
Let me know if you have any further questions on this matter.
The XamDataGrid has a SelectedItems property that contains all the information on selected cells, records and fields. http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v12.2~Infragistics.Windows.DataPresenter.DataPresenterBase~SelectedItems.html
SelectedItems.Cells is the collection that contains all the selected cells. You won't need to loop through all of your records if you use this collection.
How can I access the selected cells and change there dataitem value without using a for each loop. The only reason I want to no use a foreach loop is because I'll be dealing with thousands of records (around 10,000) at a time.
While there is no way to bind the checkbox to the Cell.IsSelected directly, you can use an intermediate property which is what development suggests doing. What I mean by this is, add a property to your underlying data object called RecordSelected and bind the checkbox to this. The binding path would be DataItem.RecordSelected.
After the binding has been set, in the SelectedItemsChanged event, determine if a cell has been selected. If it has been selected, get its associated record and then data item. From there you can set the RecordSelected property to true which would update the checkbox.