How to customize the column width and row height of the OLAP grid control?
Customizing the column width of OLAP grid control
You can customize the column width of OLAP grid control by using the ColumnWidths property of the internal grid. You can specify the custom column width value for the specific column by using its index.
Refer to the following code sample to modify the width of second, third, and fourth columns of the OLAP grid control.
[C#]
public MainWindow() { InitializeComponent(); this.Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { this.olapgrid1.InternalGrid.ColumnWidths[1] = 110; this.olapgrid1.InternalGrid.ColumnWidths[2] = 130; this.olapgrid1.InternalGrid.ColumnWidths[3] = 150; } |
[VB]
Public Sub New() InitializeComponent() AddHandler Me.Loaded, AddressOf MainWindow_Loaded End Sub Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Me.olapgrid1.InternalGrid.ColumnWidths(1) = 110 Me.olapgrid1.InternalGrid.ColumnWidths(2) = 130 Me.olapgrid1.InternalGrid.ColumnWidths(3) = 150 End Sub |
OLAP grid rendered with default column width values
OLAP grid rendered with custom column width values
Customizing the row height of OLAP grid control
You can customize the row height of OLAP grid control by using the RowHeights property of the internal grid. You can specify the custom row height value for the specific row by using its index.
Refer to the following code sample to modify the height of second, third, and fourth rows of the OLAP grid control.
[C#]
public MainWindow() { InitializeComponent(); this.Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { this.olapgrid1.InternalGrid. RowHeights [1] = 30; this.olapgrid1.InternalGrid. RowHeights [2] = 32; this.olapgrid1.InternalGrid. RowHeights [3] = 34; } |
[VB]
Public Sub New() InitializeComponent() AddHandler Me.Loaded, AddressOf MainWindow_Loaded End Sub Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Me.olapgrid1.InternalGrid.RowHeights (1) = 30 Me.olapgrid1.InternalGrid.RowHeights (2) = 32 Me.olapgrid1.InternalGrid.RowHeights (3) = 34 End Sub |
OLAP grid rendered with default row height values
OLAP grid rendered with custom row height values
Note:
The reference for assemblies such as “Syncfusion.Grid.WPF.dll” and “Syncfusion.GridCommon.WPF.dll” should be added to the WPF application to customize the column width and row height of the OLAP grid control.