Skip to content

How to maintain the DetailsView expanded state when Sorting and Grouping the DataGrid (SfDataGrid)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/How-to-maintain-the-DetailsView-expanded-state-when-Sorting-and-Grouping-the-DataGrid-SfDataGrid-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to Maintain the DetailsView Expanded State when Sorting and Grouping the WPF DataGrid?

This sample show cases how to maintain the DetailsView expanded state when Sorting and Grouping the WPF DataGrid (SfDataGrid).

When you are processing the data operation (Grouping, Sorting) the expanded DetailsViewDataGrid is collapsed in DataGrid.

Grouping

You can expand all the DetailsViewDataGrid when processing the grouping in SfDataGrid.GroupColumnDescriptions.CollectionChanged event.

this.dataGrid.GroupColumnDescriptions.CollectionChanged += GroupColumnDescriptions_CollectionChanged;

private void GroupColumnDescriptions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
    dataGrid.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle,
        new Action(() =>
        {
            this.dataGrid.ExpandAllDetailsView();
        }));
}

Sorting

You can expand all the DetailsViewDataGrid when processing sorting in SfDataGrid.SortColumnsChanged event.

this.dataGrid.SortColumnsChanged += DataGrid_SortColumnsChanged;

private void DataGrid_SortColumnsChanged(object sender, GridSortColumnsChangedEventArgs e)
{
    dataGrid.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle,
        new Action(() =>
        {
            this.dataGrid.ExpandAllDetailsView();
        }));
}

DetailsViewDataGrid are in expanded state after grouping

About

How to maintain the DetailsView expanded state when Sorting and Grouping the DataGrid (SfDataGrid)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7

Languages