Hi,
Please find attached a sample project demonstrating an issue with the XamDataGrid, when housed inside a tab control (or XamDockManager, I just used a tab control for simplicity in the example).
There is a single window, with a tab control inside, with two tabs. I've put a XamDataGrid inside each tab.
I've set a specific combination of settings, to turn off edit and record selectors and set the SelectionTypeRecord to 'single'. On the grid in the first tab only, I've set the CellClickAction to 'SelectRecord'.
Run the app, select the top record on the grid in the first tab. Now switch to the second tab... then back to the first again. The top record still appears to be selected, but try clicking on a different row... it now appears there are two rows selected even though SelectionTypeRecord is set to 'single'!
Snooping the app shows that only the second 'selected' record has IsSelected and IsActive set to true.... the top record has both these values set to false but is still showing in a 'selected' style.
The grid in the second tab, whose CellClickAction has been left on 'SelectCell', works as expected.
Dave
Hi Dave,
This issue should be resolved in the latest service release, builds 10.1.20101.2040 or 10.2.20102.2001.
Please let me know if you have any further questions or concerns about this matter.
Hi Jason,
Cheers, much appreciated.
Hello Dave,
I have heard back from the development team and they have requested that this be logged as an issue in our tracking system for further research for a fix. I will be following up with you through your case, CAS-45716-NTFYYB, with further details.
Please note that workaround in the meantime is to cancel the SelectedItemsChanging event if the grid is unloaded:
Private Sub Grid1_SelectedItemsChanging(ByVal sender As Object, ByVal e As SelectedItemsChangingEventArgs) Handles Grid1.SelectedItemsChanging
If Not Grid1.IsLoaded Then
e.Cancel = True
End If
End Sub
Just to give you a quick status update, I was able to reproduce your issue using the sample you provided. I'm now discussing this issue with the development team.
I'll keep you notified any further information that I receive.
I've downloaded the hotfix and it does fix the problem I described above... unfortunately I don't think it's working as it should still.
The problem appears to be that the SelectedItems.Records collection is getting cleared when you move to the second tab. I've updated my sample; tab 1 has a grid in (with extended record selection enabled) , tab 2 is empty. There is a label at the top of the window, bound to the grids "SelectedItems.Records.Count".
If you select a record on the grid, the count returns 1.
Now move to "Tab 2" and the count gets changed to 0.
Moving back to tab 1, shows the record you clicked on as "selected" but it is no longer in the selected items collection.
Furthermore - if you select multiple records in tab 1, the count shows correctly. Goto tab 2, count clears, and moving back to tab 1 just shows the last record of the extended selection as "selected".
Regards,