RadVirtualGrid will enable resizing of its columns and disable resizing of the rows.
The control enables changing the column width and row height at runtime through the UI. This can be achieved by positioning the mouse over the columns vertical grid line and dragging it until the needed width of the column is achieved. Respectively, the rows can be resized by placing the mouse cursor over the horizontal grid line in the row header and dragging to the required height.
Resizing the columns of RadVirtualGrid
The mechanism that the control provides for disabling the column resizing, is its
CanUserResizeColumns property. When set to False, the user will not be able to resize the columns of the control.
The ability to resize the rows of RadVirtualGrid can be manipulated through the
CanUserResizeRows property. Its default value is False. When set to true, the user will be able to resize the rows of the control.
The ability to use this mechanism depends on the value of the
MeasureTextOnRenderproperty. More information can be found in the Getting Started
RadVirtualGrid supports setting the width of a given column to be as large as biggest cell's content present in the viewport. This can be done through the
FitColumnWidthToContent method. It accepts the index of the column that needs to be resized.
If the MeasureTextOnRender property is set to True, the FitColumnWidthToContent method will return the calculated column width. Otherwise, the return value will be 0.0.
Invoking the FitColumnWidthToContent also depends on the MainPanel of the control to be loaded. This is needed, so the control can actually perform the measuring calculations. Thus, calling the method right after the
InitializeComponentmethod of the application is not recommended.
A possible way to ensure that the visual elements of RadVirtualGrid are already generated, is to handle the
Loaded event of the control.
Invoking the FitColumnWidthToContent method
private void VirtualGrid_Loaded(object sender, RoutedEventArgs e)