DataGrid RowDetailsPane visibility bound to a property?

Sep 24, 2009 at 1:38 PM

Hi,

I am using a WPF Datagrid with a RowDetails panel where the RowDetailsVisibilityMode is set to "VisibleWhenSelected" and the SelectionMode="Extended" so that multiple rows can be selected and hence display RowDetails, as below:

<dg:DataGrid x:Name="MyGrid"
             
ItemsSource="{Binding Path=MyItems}"
             
AutoGenerateColumns="True"
             
SelectionMode="Extended"
             
RowDetailsVisibilityMode="VisibleWhenSelected">

 
<dg:DataGrid.RowDetailsTemplate>
   
<DataTemplate>
     
<TextBlock Text="Further Details..."/>
   
</DataTemplate>
 
</dg:DataGrid.RowDetailsTemplate>
  ...
</dg:DataGrid>

Unfortunately, for this application it isn't intuitive to display row details on 'selected' rows, the client would like to click a checkbox on a number of rows to display the RowDetails pane, but also scroll around the grid selecting other rows. In other words fix the rows that display RowDetails no matter what happens on the DataGrid.

So currently scrolling around closes the RowDetailsPanes that they have opened. What I would like to do is to have a checkbox in one of the columns and bind the RowDetails panel visibility to this property but I can't figure out how to do it. The problem is simply that RowDetailsPane only operates on the row selection(s) in the datagrid - can it be extended somehow to operate on a property of my choosing?

Thanks in advance, Will