I have a DataGrid
. It has DataGrid.RowDetailsTemplate
. When a button is clicked it should Expand / Collapse; how would I do that?
<Custom:DataGrid RowDetailsVisibilityMode="VisibleWhenSelected" SelectionMode="Extended" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False">
<Custom:DataGrid.RowDetailsTemplate>
<DataTemplate>
<Custom:DataGrid>
<Custom:DataGrid.Columns>
<Custom:DataGridTextColumn Binding="{Binding idClient, Mode=Default}" Header="Ид" IsReadOnly="True"/>
<Custom:DataGridTextColumn Binding="{Binding name_client, Mode=Default}" Header="Имя" IsReadOnly="True"/>
</Custom:DataGrid.Columns>
</Custom:DataGrid>
</DataTemplate>
</Custom:DataGrid.RowDetailsTemplate>
<Custom:DataGrid.Columns>
<Custom:DataGridTemplateColumn>
<Custom:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Expander IsExpanded="True"/>
</DataTemplate>
</Custom:DataGridTemplateColumn.CellTemplate>
</Custom:DataGridTemplateColumn>
<Custom:DataGridTextColumn Binding="{Binding idPartner, Mode=Default}" Header="Ид" IsReadOnly="True"/>
<Custom:DataGridTextColumn Binding="{Binding name_partner, Mode=Default}" Header="Имя" IsReadOnly="True"/>
</Custom:DataGrid.Columns>
</Custom:DataGrid>
Expander_Expanded
andExpander_Collapsed
are identical. if it is intended, there can be a single method to handleExpanded
andCollapsed
events – Preferment