Hi folks,
Here is what I am trying to do:
When the user clicks on one record containing data of Product 1, all other records with data from Product 1 should be selected / highlighted.
In my sample project I programmatically add the corresponding records to the datagrid.SelectedItems collection.
For a blink you can see, that the other records are selected aswell, but I want them to stay selected / highlighted.
I have added my test project. Thanks for any input in advance.
Hello,
When activating a record the SelectedItemsChanging and SelectedItemsChanged events are raised and any changes to the this.myDataGrid.SelectedItems.Records collection also fire these two events and you end up in an infinite loop. What you can do is something like this in your myDataGrid_SelectedItemsChanged event:
if (this.myDataGrid.SelectedItems.Records.Count == 1)
{
this.myDataGrid.SelectedItems.Records.Clear();
}
else
if (this.myDataGrid.SelectedItems.Records.Count == 0)
this.myDataGrid.SelectedItems.Records.AddRange(selRecs.ToArray());
Instead of doing it in HighlightRecords (in RecordActivating
and RecordActivated), In order to control the event raising.
Please let me know if you require any further assistance.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
This helped a lot, thanks.