|
1 | | -# How to maintain the DetailsView expanded state when Sorting and Grouping the DataGrid SfDataGrid |
| 1 | +# How to Maintain the DetailsView Expanded State when Sorting and Grouping the WPF DataGrid? |
2 | 2 |
|
3 | | -This sample show cases how to maintain the DetailsView expanded state when Sorting and Grouping the [WPF DataGrid](https://www.syncfusion.com/wpf-ui-controls/datagrid) (SfDataGrid)? |
| 3 | +This sample show cases how to maintain the DetailsView expanded state when Sorting and Grouping the [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid) (SfDataGrid). |
4 | 4 |
|
5 | | -When you are processing the data operation (Grouping, Sorting) the expanded DetailsViewDataGrid is collapsed in [WPF DataGrid](https://www.syncfusion.com/wpf-ui-controls/datagrid) (SfDataGrid). |
| 5 | +When you are processing the data operation ([Grouping](https://help.syncfusion.com/wpf/datagrid/grouping), [Sorting](https://help.syncfusion.com/wpf/datagrid/sorting)) the expanded DetailsViewDataGrid is collapsed in DataGrid. |
6 | 6 |
|
7 | 7 | ### Grouping |
8 | 8 |
|
9 | | -You can expand all the `DetailsViewDataGrid` when processing the grouping in `SfDataGrid.GroupColumnDescriptions.CollectionChanged` event. |
| 9 | +You can expand all the `DetailsViewDataGrid` when processing the grouping in `SfDataGrid.GroupColumnDescriptions.CollectionChanged` event. |
10 | 10 |
|
11 | | -```C# |
| 11 | +``` Csharp |
12 | 12 | this.dataGrid.GroupColumnDescriptions.CollectionChanged += GroupColumnDescriptions_CollectionChanged; |
13 | 13 |
|
14 | 14 | private void GroupColumnDescriptions_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
15 | 15 | { |
16 | 16 | dataGrid.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, |
17 | | - new Action(() => |
18 | | - { |
19 | | - this.dataGrid.ExpandAllDetailsView(); |
20 | | - })); |
| 17 | + new Action(() => |
| 18 | + { |
| 19 | + this.dataGrid.ExpandAllDetailsView(); |
| 20 | + })); |
21 | 21 | } |
22 | 22 | ``` |
| 23 | + |
23 | 24 | ### Sorting |
24 | 25 |
|
25 | 26 | You can expand all the `DetailsViewDataGrid` when processing sorting in `SfDataGrid.SortColumnsChanged` event. |
| 27 | + |
26 | 28 | ``` C# |
27 | 29 | this.dataGrid.SortColumnsChanged += DataGrid_SortColumnsChanged; |
28 | 30 |
|
29 | 31 | private void DataGrid_SortColumnsChanged(object sender, GridSortColumnsChangedEventArgs e) |
30 | 32 | { |
31 | 33 | dataGrid.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.ApplicationIdle, |
32 | | - new Action(() => |
33 | | - { |
34 | | - this.dataGrid.ExpandAllDetailsView(); |
35 | | - })); |
| 34 | + new Action(() => |
| 35 | + { |
| 36 | + this.dataGrid.ExpandAllDetailsView(); |
| 37 | + })); |
36 | 38 | } |
37 | 39 | ``` |
| 40 | + |
| 41 | + |
0 commit comments