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?
Hi dvickerie,
When you implemented this, did you follow the information contained inside our blog post on this topic? http://es.infragistics.com/community/blogs/josh_smith/archive/2008/09/04/adding-checkboxes-to-the-record-selectors-in-xamdatagrid.aspx
I've taken the sample from here and upgraded it to 12.1 to try and reproduce the issue you're experiancing but I'm unable to. Are you implementing this a different way?
I figured out what I was doing wrong and found a fix for that. However my issue I'm having is I've bound IsChecked to the Record.IsSelected:
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Record.IsSelected, Mode=TwoWay}"
It works fine when the setting CellClickAction="SelectRecord" however the users' dont want to have to double click to edit a records so if I change the setting to EnterEditModeIfAllowed the CTRL and SHIFT functionality no longer works. I tried in the CellActivated event to set the cell.Records.IsSelected to true however that didn't work for me. Unfortauanely the Josh Smith example wouldn't satisfy our needs.
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.
Let me know if you have any further questions on this matter.
HI,
We are facing one issue with XamDataGrid.
User Action - User goes to particular screen do select multiple rows and then right click to do some action on them.
Problem description: User is required to hold control or shift key to select multiple record if he does not select these control then after right click few records are left selected.
From our side we have set SelectionTypeField = "Extended", Please help us to solve this issue as this some time really annoying for the end user.
Please note similar action works perfectly in WinGrid.
Thanks
Kartik Chhabra
@ dvickerie,
I think in the case when the user clicks on a 'Select All' button that it might just be better to loop through XamDataGrid.Records instead of XamDataGrid.SelectedItems.Cells. You're not going to be able to completely avoid looping through cells/records though. Here is a code snippet of what I mean.
if (SelectAll) { foreach (Record rec in xamDataGrid1.Records) { (rec.DataItem as MyDataItem).RecordSelected = true; } } else { foreach (Cell cell in XamDataGrid1.SelectedItems.Cells) { (cell.Record.DataItem as MyDataItem).RecordSelected = true; } }
@ Kartik,
For multiple selection I think you want to use SelectionTypeRecord = "Extended". Do you mean that when you right click that you are losing your selected records? This shouldn't be the case as I've tested this and after selecting multiple rows, right-clicking does not clear or modify the currently selected records. Which version of NetAdvantage are you using?
Many thanks for your quickly reply.
Issue was resolved as I found the code in the project where right click was restricted to ctrl and shift key, commenting that part has resolved the issue.
Let me know if you have any further questions on this issue.
Let me know if you have any further questions.