I am trying to get a reference to the row that is selected in my subgreate created with a Column Layout. The XamGrid.ActiveItem is null when the row in my subgrid is selected. I am trying to pull data from properties of the objects showing in my subgrid.
Hello Gary,
Please clarify your requirements, I am unsure what you are trying to accomplish. To help you get started however, I recommend handling the XamGrid's SelectedRowsCollectionChanged event which will expose the following properties
NewSelectedItems - A collection of items that are currently selected.
PreviouslySelectedItems - A collection of items that were previously selected.
eg.
C# this.MyGrid.SelectedRowsCollectionChanged += new EventHandler<SelectionCollectionChangedEventArgs<SelectedRowsCollection>>(MyGrid_SelectedRowsCollectionChanged); void MyGrid_SelectedRowsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedRowsCollection> e) { System.Diagnostics.Debug.WriteLine("Number of selected rows changed from " + e.PreviouslySelectedItems.Count + " to " + e.NewSelectedItems.Count); }
this.MyGrid.SelectedRowsCollectionChanged += new EventHandler<SelectionCollectionChangedEventArgs<SelectedRowsCollection>>(MyGrid_SelectedRowsCollectionChanged); void MyGrid_SelectedRowsCollectionChanged(object sender, SelectionCollectionChangedEventArgs<SelectedRowsCollection> e) { System.Diagnostics.Debug.WriteLine("Number of selected rows changed from " + e.PreviouslySelectedItems.Count + " to " + e.NewSelectedItems.Count); }
<ig:XamGrid x:Name="MyGrid" SelectedRowsCollectionChanged="MyGrid_SelectedRowsCollectionChanged" ></ig:XamGrid>
Let me know if you have any questions.