You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# WPF Data Grid – Resize Row Height with a Splitter
8
+
# WPF Data Grid – Resize Row Height
9
9
10
-
This example configures the [`GridControl`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.GridControl) to resize row height with a splitter. The grid uses a custom control that stores row height in the [`RowData.RowState`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.RowData.RowState) property, so the height persists after refresh.
10
+
This example implements resizable rows in a DevExpress WPF [Grid](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.GridControl). Users can interactively change the height of individual grid rows (similar to resizing columns) and retain these changes for a consistent user experience.
11
11
12
12

13
13
14
-
Use this technique when you need to:
14
+
## Implementation Details
15
15
16
-
* Allow users to resize rows manually.
17
-
* Persist row height after a user updates data or scrolls a view.
18
-
* Integrate a splitter into the row template.
16
+
### Create a Resizable Control
19
17
20
-
## Implementation Details
18
+
The `ResizableDataRow` control implements the `IResizeHelperOwner` interface to work with `ResizeHelper`. The control stores the current row height in the `RowHeight` property and updates this value when the splitter moves.
The `RowHeight` attached property stores the height value in the `RowState` object. The grid uses this value to restore the row height after scrolling or refreshing. The `ResizableDataRow` control gets and sets the row height through the `RowState`:
1. Create a custom control that implements the `IResizeHelperOwner` interface.
23
-
2. Add an attached `RowHeight` property to store the current height in the `RowState`.
24
-
3. Define a `DataRowTemplate` for the view that includes the following:
25
-
- A `ContentControl` bound to the [`DefaultDataRowTemplate`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.TableView.DefaultDataRowTemplate) to display the row content.
26
-
- A custom `ResizableDataRow` control with a `RowSplitter` in its template.
27
-
4. Bind the `ContentControl.Height` property to the `RowHeight` property to apply size changes.
The [`DataRowTemplate`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Grid.TableView.DataRowTemplate) contains a `ContentControl` that displays the default row content and a `ResizableDataRow` control with a `RowSplitter` to change the row height:
@@ -56,23 +76,6 @@ Use this technique when you need to:
56
76
</DataTemplate>
57
77
```
58
78
59
-
### Custom Control
60
-
61
-
The `ResizableDataRow` control implements the `IResizeHelperOwner` interface to work with `ResizeHelper`. The control stores the current row height in the `RowHeight` property and updates this value when the splitter moves.
0 commit comments