Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Dynamically Control the Height of Individual Rows

The following code demonstrates a GridView.CalcRowHeight event handler.

This event is used to specify heights of individual rows. It is assumed that a View (gridView1) displays data from the DataView data source, which contains the RowHeight column. This column specifies the height to set for a specific row.

using DevExpress.XtraGrid.Views.Grid;

private void gridView1_CalcRowHeight(object sender, RowHeightEventArgs e) {
    GridView view = sender as GridView;
    if (view == null) return;
    if(e.RowHandle >= 0)
        e.RowHeight = (int)view.GetDataRow(e.RowHandle)["RowHeight"];
}