I've encountered an issue that I am guessing is a bug caused by IG virtualization/grid reuse.
I have one user control containing a XamWebGrid (named "mainGrid") which is bound to rows of one type (e.g., ParentClass). When I double-click a row of the parent grid, I open a user control inheriting from ChildWindow that contains a grid (named "childGrid") bound to another type (e.g., ChildClass). When Handling the XamWebMenuItem_Loaded event, I check whether an item has been selected. If I have previously chosen an item from "parentGrid" then the "childGrid" SelectedRows collection contains a selected row (even though I have not yet selected anything in "childgrid"). Additionally, the Data property is of type ParentClass not ChildClass, which suggests to me that the selection settings of the grid being reused for speed are not being initialized/cleared.
Is there something I'm missing here, or is this a bug? I will probably implement something like the following as a workaround, but I'm hoping you have a better solution ...
Private Sub childGrid_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
If childGrid.SelectionSettings IsNot Nothing AndAlso childGrid.SelectionSettings.SelectedRows IsNot Nothing Then
childGrid.SelectionSettings.SelectedRows.Clear()
End If
End Sub
Thanks for your time.
I'm actually having a really tought time reproducing this. It still happens everytime I follow those steps in my actual application, but making a demo application that doesn't have sensitive business logic/data in it is proving difficult. The workaround seems to do the trick anyway. I guess you can consider this one resolved unless I can come up with a good example. Thanks just the same.