I want do smth like that but i dont know how binding RowDetailsVisibilityMode to bool variable from ViewModel in MVVM. RowDetailsVisibility is Collaped when i select row, but if i click on button RowDetailsVisibility == Visability
Events i ignore, because i dont know i do it from command (i change ContentControl from command)
I tried Converter, but i doint know how setting it
My RowDetailsTemplate
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<Grid>
<TextBlock Foreground="White" Margin="16" Text="{Binding ContolPageName, Mode=TwoWay}"/>
</Grid>
</DataTemplate>
</DataGrid.RowDetailsTemplate>
Command like that
public void ExecuteEditDataGridFormatViewCommand(object obj)
{
if (!VisabilityRowDetailsTemplate)
{
CurrentChildsView = new DataGridFormatViewModel();
//row.DetailsVisibility = row.DetailsVisibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
ContolPageName = "PANEL";
VisabilityRowDetailsTemplate = true;
}
else
{
VisabilityRowDetailsTemplate = false;
}
}

To show the row details of a
DataGridin an MVVM compliant way you don't need the view model to participate. It doesn't make much sense, because you don't want to show the details based on some data related condition but on the pressing of a button. This is purely view related problem.You can use routed commands and handle them in the code-behind.
The following example uses a custom routed command. However, you can also choose to use a predefined routed command. The usage remains the same.
MainWindow.xaml.cs
Define the routed command and the command
CommandBinding.Executedand theCommandBinding.CanExecutehandlers and implement the toggling of the row detail visibility.MainWindow.xaml
Define a dedicated column that contains a
ToggleButtonto toggle the visibility of the row's details view.