Hello Christopher,
Currently, the IsExpandedBinding and IsExpandableBinding properties are only supported when using GridViewTableDefinition. However, I think that you could still achieve the desired expand/collapse logic of all rows when a button is clicked. This could be done by utilizing the RowDetailsVisibilityMode property of the RadGridView control. A property of type GridViewRowDetailsVisibilityMode could be defined inside your view model, which could be bound to the mentioned RadGridView property, and via a command, you could change its value.
The following code snippets show a sample implementation of these suggestion's implementation:
public class MainViewModel : ViewModelBase
{
private GridViewRowDetailsVisibilityMode visibilityMode;
public MainViewModel()
{
this.VisibilityMode = GridViewRowDetailsVisibilityMode.Collapsed;
this.ChangeVisibilityModeCommand = new DelegateCommand(OnCmdExecuted);
}
public GridViewRowDetailsVisibilityMode VisibilityMode
{
get { return visibilityMode; }
set { visibilityMode = value; this.OnPropertyChanged(nameof(this.VisibilityMode)); }
}
public ICommand ChangeVisibilityModeCommand { get; set; }
private void OnCmdExecuted(object obj)
{
if (this.VisibilityMode == GridViewRowDetailsVisibilityMode.Collapsed)
{
this.VisibilityMode = GridViewRowDetailsVisibilityMode.Visible;
}
else if (this.VisibilityMode == GridViewRowDetailsVisibilityMode.Visible)
{
this.VisibilityMode = GridViewRowDetailsVisibilityMode.Collapsed;
}
}
}
<Grid>
<Grid.DataContext>
<local:MainViewModel/>
</Grid.DataContext>
<telerik:RadGridView Name="gridview" RowDetailsVisibilityMode="{Binding VisibilityMode}"/>
</Grid>
The following result is present on my end when the ChangeVisibilityModeCommand is executed:
I have also attached a sample application, so, could you give it a try?
Regards,
Stenly
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.