2

I have a WPF datagrid control with a RowDetailsTemplate. I would like to be able to set a property on an object bound to the row to set whether that particular row should display details.

So for example if I have a basic layout like below and the "Detail" object had a boolean property called "Expanded" is there somewhere I can bind that property to have the details for its row show or not when the value changes?

<DataGrid ItemsSource="{Binding CollectionOfDetailObjects}">
    <DataGrid.Columns>
        <!--My columns here-->
    </DataGrid.Columns>
    <DataGrid.RowDetailsTemplate>
        <DataTemplate>
            <!--Details to show sometimes-->
        </DataTemplate>
    </DataGrid.RowDetailsTemplate>
</DataGrid>
H.B.
  • 166,899
  • 29
  • 327
  • 400
classicspage
  • 161
  • 1
  • 4
  • 12

1 Answers1

2

You can bind the DetailsVisibility in the DataGrid.RowStyle.

H.B.
  • 166,899
  • 29
  • 327
  • 400
  • 2
    Something like this worked. Thanks! ` ` – classicspage Jun 11 '12 at 14:35