I have two grids on different views and their selected row is kept in sync through code.
If i click on a row in grid one this shows the other grid with the proper row selected. If i then click a new row in grid two and go back to gird one my original selection is still highlighted.
before setting the new selection active/selected i have tried:
Iterating through all the records setting IsSelected and IsActive to false (didn't work)
Setting _dataGrid.SelectedItems.Records.Clear() (didn't work)
Anything else that i can try?
thanks,
Jamie
Hello,
I have been looking into your question and I noticed that you mentioned that grids are in different views. If that means that they are in different TabItems, then this behavior is a known issue that is currently being investigated by our developers team.
If this is your scenario, then you should consider approaches that include applying your settings in the grid’s load event. What you can do is obtaining the Grid A’s newly selected records and store them, so in the Grid B’s loaded event handler you can apply them after clearing the records collection (Records.Clear()).
Please let me know if you need further assistance regarding the discussed matter.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
>What you can do is obtaining the Grid A’s newly selected records and store them, so in the Grid B’s >loaded event handler you can apply them after clearing the records collection (Records.Clear()).
My problem is that the old selections won't clear.
These grid are not in tabs, the are on different panels (views) within the app. I'm not able to clear the old selections. Adding the new selection works correctly.
Thanks Elena, that did the trick.
Hello jamcquay,
Thank you for modifying the sample. I have been looking into this and I can suggest you clear the Selected cells collection along with the selected rows as follows:
xamDataGrid1.SelectedItems.Records.Clear();
xamDataGrid1.SelectedItems.Cells.Clear();
xamDataGrid1.SelectedItems.Fields.Clear();
This way every time you change the view you will clear the all of the selected items on your XamDataGrid.
If you have any additional questions on this matter or if I have misunderstand you in any way please feel free to ask.
Hi Ekaterina,
I can reproduce my problem in the sample that you made. I've updated your project to the infragistics dlls i'm using and I also set the SelectionTypeRecord to Extended for the grids
to reproduce
1. Shift-click 2-3 records in the first grid
2. Click the button
3. The first of the selected is highlighted in the second (good)
4. Click another row in the second grid
5. Click the button
6. The original rows are still highlighted in the first grid
I am just checking your progress on the issue.
If you require any further assistance please do not hesitate to ask.
Infragistics
Thank you for your answer.
I have created a sample project that illustrates the SelectedItems.Records.Clear() method’s functionality.
Would you please take a look at this sample and compare with the usage scenario in your application.
Please let me know if I can assist you further.