windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-ad1ccb57.md
Gets or sets the cell height within data rows.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DefaultValue(-1)]
[DXCategory("Appearance")]
[XtraSerializableProperty(XtraSerializationFlags.AutoScaleY)]
public int RowHeight { get; set; }
<DefaultValue(-1)>
<XtraSerializableProperty(XtraSerializationFlags.AutoScaleY)>
<DXCategory("Appearance")>
Public Property RowHeight As Integer
| Type | Default | Description |
|---|---|---|
| Int32 | -1 |
An integer value specifying the data cell height in pixels.
|
All data cells and rows have the same default height, the minimum height is that required to fit a single text line. The required height is automatically calculated based on font settings applied (except for the focused row style). If the RowHeight property value is -1 , the calculated value specifies the actual height of data cells. You can set the RowHeight property to a positive integer to increase the cell height.
Note : in Advanced Banded Grid Views, cells can be arranged into several rows within a single data row. Thus, the actual height of a data row can be a multiple of the RowHeight property value.
Please refer to the Rows topic for information on how to specify the group rows height and how to apply variable heights to rows.
The code sample below illustrates how to change row height dynamically.
gridView.CalcRowHeight += (sender, e) => {
if(e.RowHandle % 2 == 0) {
e.RowHeight = 50;
}
};
AddHandler gridView.CalcRowHeight, Sub(sender, e)
If e.RowHandle Mod 2 = 0 Then
e.RowHeight = 50
End If
End Sub
The following code snippets (auto-collected from DevExpress Examples) contain references to the RowHeight property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richedit-in-an-active-grid-cell/CS/Form1.cs#L60
gridView1.RowHeight = 120;
}
winforms-grid-display-edit-rtf-data/CS/Form1.cs#L48
gridView1.OptionsView.RowAutoHeight = true;
gridView1.RowHeight = 30;
gridColumn1.Width = 20;
winforms-grid-image-slider-cell-editor/CS/WindowsFormsApplication202/ImageSliderHelper.cs#L30
view.Columns["Description"].OptionsColumn.AllowEdit = false;
view.RowHeight = slider.Size.Height;
view.ShownEditor += view_ShownEditor;
winforms-richedit-in-an-active-grid-cell/VB/Form1.vb#L53
gridView1.Columns("MyData(RichEdit)").ColumnEdit = repositoryItemRichTextEdit
gridView1.RowHeight = 120
End Sub
winforms-grid-display-edit-rtf-data/VB/Form1.vb#L43
gridView1.OptionsView.RowAutoHeight = True
gridView1.RowHeight = 30
gridColumn1.Width = 20
winforms-grid-visualize-master-detail-data/VB/Form1.vb#L52
'Change row height in the master View
gridView1.RowHeight = 50
'Create columns for the detail pattern View
winforms-grid-image-slider-cell-editor/VB/WindowsFormsApplication202/ImageSliderHelper.vb#L34
view.Columns("Description").OptionsColumn.AllowEdit = False
view.RowHeight = slider.Size.Height
AddHandler view.ShownEditor, AddressOf view_ShownEditor
See Also