I have a RadGridView with one of its columns being a GridViewToggleRowDetailsColumn to allow the operator to expand or collapse the selected row details.
Next to the grid I have a checkbox that I want to use to expand/collapse all rows details in a single click if needed.
I’ve managed to partially do it by using the following code, but the collapse doesn’t work unless I disable row virtualization which I cannot.
Does anyone have a solution to this problem?
private void ToggleAllRowsDetails(object sender, RoutedEventArgs e)
{
if(DataContext is MyViewModel vm)
{
using (MyGrid.DeferRefresh())
{
if (MyRowDetails.IsChecked.Value)
{
MyGrid.RowDetailsVisibilityMode = GridViewRowDetailsVisibilityMode.Visible;
}
else
{
MyGrid.RowDetailsVisibilityMode = GridViewRowDetailsVisibilityMode.Collapsed;
}
}
}
}