DataGrid in RowDetailsTemplate

Apr 16, 2010 at 6:44 PM
Hi, I have few issues with row selection in Datagrid with RowDetailsTemplate which has another DataGrid in it. 1. How do i get reference of the grid that is inside a RowDetailsTemplate, from the codebehind file. I am using the below approach, but i dont think its correct, as i have somany issues with this way of referring. Microsoft.Windows.Controls.DataGrid m_dgLinkedConcepts = new Microsoft.Windows.Controls.DataGrid(); public void dgLinkedConcepts_Loaded(object sender, RoutedEventArgs e) { m_dgLinkedConcepts = sender as Microsoft.Windows.Controls.DataGrid; } 2. When i select a row in childgrid inside the RowDetailsTemplate, the SelectionChanged event of both the child and the parent grid are getting executed. 3. When i select a row in childgrid say for parent grid row1, and then select a different row in parent grid say row2, now if i select row1 in parent grid again, still the child grid row selection is retained. When i select a parent grid row and my RowDetailsTemplate expands, i donot want any of the child grid rows in selected mode. I tried clearing the selected items of the child grid in RowDetailsVisibilityChanged event. But it didnt work. Can anyone please let me know if i need to set any properties which can solve the above issues. Thanks, Jaya.