Skip to main content
A newer version of this page is available. .

GridOptionsView.RowAutoHeight Property

Gets or sets whether the Data Grid automatically adjusts data row heights depending on cell content.

Namespace: DevExpress.XtraGrid.Views.Grid

Assembly: DevExpress.XtraGrid.v18.2.dll

Declaration

[DefaultValue(false)]
[XtraSerializableProperty]
public virtual bool RowAutoHeight { get; set; }

Property Value

Type Default Description
Boolean **false**

true to change the data row height automatically; otherwise, false.

Property Paths

You can access this nested property as listed below:

Object Type Path to RowAutoHeight
AdvBandedGridView
.OptionsView.RowAutoHeight
BandedGridView
.OptionsView.RowAutoHeight
GridView
.OptionsView.RowAutoHeight

Remarks

When cells display large text values or images, you can enable the RowAutoHeight feature to ensure that the cells display their contents completely.

Note

The row auto height feature is supported when grid cells embed one of the following in-place editors: MemoEdit (RepositoryItemMemoEdit), TokenEdit (RepositoryItemTokenEdit), PictureEdit (RepositoryItemPictureEdit) or HypertextLabel (RepositoryItemHypertextLabel).

If you disable the RowAutoHeight option, all data rows have the same height specified by the View’s GridView.RowHeight property.

Note

Advanced banded grid Views do not support automatic row height calculation, so the RowAutoHeight property is not in effect.

If the RowAutoHeight property is set to true, pixel-based vertical row scrolling is not available, even if the GridOptionsBehavior.AllowPixelScrolling property is forcibly set to True.

The code sample below illustrates how to hide the partially visible row in a grid.

GridOptionsView - Partial Row Hidden


gridView1.OptionsView.RowAutoHeight = true;
gridView1.TopRowChanged += GridView1_TopRowChanged;
gridView1.CustomDrawCell += GridView1_CustomDrawCell;

private bool IsPartiallyVisible(int rowHandle)
{
    return gridView1.IsRowVisible(rowHandle) == RowVisibleState.Partially;
}
private void GridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
    if (IsPartiallyVisible(e.RowHandle))
    {
        GridCellInfo cellInfo = e.Cell as GridCellInfo;
        cellInfo.Lines.Clear();
        e.Handled = true;
    }
}

private void GridView1_TopRowChanged(object sender, EventArgs e)
{
    gridControl1.Refresh();
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the RowAutoHeight 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.

See Also