Xceed Grid for WinForms v4.3 Documentation
How to change the height of rows

Welcome to Xceed Grid for WinForms v4.3 > Task-Based Help > Appearance > How to change the height of rows

The height of each row in the grid can be changed in various ways:

If you want to change the height of a specific row in the grid to a predetermined value, you simply need to set that row's Height property. If you want to set the height of all the DataRows in the grid,   you can set the Height property of the DataRowTemplate to the desired value. The same goes with the AutoHeightMode and FitHeightToEditors property as well as the GetFittedHeight method.

Demonstration

To change the height of a specific row (using the various methods mentioned above) you can use the following code:

VB.NET Copy Code
GridControl1.FixedHeaderRows[ 0 ].Height = 16
GridControl1.FixedFooterRows[ 1 ].AutoHeightMode = AutoHeightMode.AllContent

GridControl1.Groups[ 0 ].HeaderRows[ 0 ].Height = gridControl1.FixedHeaderRows[ 0 ].GetFittedHeight( AutoHeightMode.AllContent )

GridControl1.DataRows[ 0 ].FitHeightToEditors = True                 
C# Copy Code
gridControl1.FixedHeaderRows[ 0 ].Height = 16;
gridControl1.FixedFooterRows[ 1 ].AutoHeightMode = AutoHeightMode.AllContent;

gridControl1.Groups[ 0 ].HeaderRows[ 0 ].Height = gridControl1.FixedHeaderRows[ 0 ].GetFittedHeight( AutoHeightMode.AllContent );

gridControl1.DataRows[ 0 ].FitHeightToEditors = true;              

To change the height of every DataRow in the grid, the most efficient way is to use the DataRowTemplate. Of course you can use any one of the properties or methods mentioned above! For example:

VB.NET Copy Code
GridControl1.DataRowTemplate.Height = 16
C# Copy Code
gridControl1.DataRowTemplate.Height = 16;

If the DataRowTemplate changes while the DataSource property is set, the changes will not automatically be reflected in the grid. In order for the modifications to be applied, the data source must be reassigned to the DataSource property. 

If you want to set various properties of the DataRowTemplate when you populate your grid (set the DataSource property), then this will need to be done between calls to the grid's BeginInit and EndInit methods.

VB.NET Copy Code
GridControl1.BeginInit()
GridControl1.DataSource = DataSet11.Tables( 0 )
GridControl1.DataRowTemplate.FitHeightToEditors = True
GridControl1.EndInit()
C# Copy Code
gridControl1.BeginInit();
gridControl1.DataSource = dataSet11.Tables[ 0 ];
gridControl1.DataRowTemplate.FitHeightToEditors = true;
gridControl1.EndInit();

If you are providing data manually, then you can set the values of the DataRowTemplate after you have added columns to the grid.