How to auto-size the rows to fill the grid's height
Environment
Product Version | 2018.3.911 |
Product | RadGridView for WinForms |
Description
RadGridView allows you to adjust the columns' width automatically to fill the entire width of the control. This is controlled by the AutoSizeColumnsMode property. This article will demonstrate a sample approach how to achieve a similar functionality for the rows. In other words, it shows how to adjust the rows' height to fill the height of the control.
Solution
The TableElement.RowHeight property controls the height of the rows in the grid. The following code snippet calculates the RowHeight considering the current size of RadGridView and rows count:
If some of the system rows are displayed as well, their height should participate in the calculation. You can access a system row by the respective property exposed in the MasterView.