There are a number of ways to customize the look & feel of your RadGridView control. This topic covers some of the most important of these properties.
Tip |
|---|
| If you need to completely redesign your RadGridView control, take a look at the Templating section. |
General
This section covers the following properties:
- GridLinesVisibility - control the way by which the grid lines are visualized. Choose one of the four possible values defined in the GridLinesVisibility enumeration: Both, Horizontal, Vertical and None.
- ShowColumnHeaders - show\hide the column headers.
- ShowColumnFooters - show\hide the column footers.
- ColumnBackground - define default background color for all columns.
- VerticalGridLinesBrush - define default color for all vertical grid lines.
- HorizontalGridLinesBrush - define default color for all horizontal grid lines.
Here is a small sample, demonstrating the usage of some of the above properties.
CopyXAML
<telerik:RadGridView x:Name="radGridView"
GridLinesVisibility="Vertical"
ShowColumnFooters="True"
ShowColumnHeaders="False"
ColumnBackground="Bisque"/>The final result should be similar to this:
You can see that the columns headers are not visible, while the column footers are, moreover there are only vertical grid lines and the columns' background of all columns is set to Bisque.
Columns
This section covers the following properties:
MinColumnWidth - gets or sets the minimum width constraint of a GridViewColumn. The minimum width of the object, in pixels. This value can be any value equal to or greater than 0. However, System.Double.PositiveInfinity is not valid.
MaxColumnWidth - gets or sets the maximum width constraint of a GridViewColumn. The maximum width of the object, in pixels. The default is System.Double.PositiveInfinity. This value can be any value equal to or greater than 0. System.Double.PositiveInfinity is also valid.
ColumnWidth - gets or sets the width of a GridViewColumn.
Here is a small sample, demonstrating the usage of some of the above properties.
CopyXAML
<telerik:RadGridView x:Name="radGridView" MinColumnWidth="20" MaxColumnWidth="100" ColumnWidth="80"/>
Rows
This section covers the following properties:
RowIndicatorVisibility - show\hide the row indicators, located on left of each row.
RowDetailsVisibilityMode - control the way by which row details are visualized. Choose one of the three possible values defined in the GridViewRowDetailsVisibilityMode enumeration: Collapsed, Visible and VisibleWhenSelected.
AlternationCount - control the alternate rows. Usually you need to set it to 2, so every second row will have alternating style applied.
RowStyle - specify a style for the grid rows. Read more
AlternateRowStyle - specify a style for the alternative grid rows. Read more
RowDetailsStyle - specify a style for the row details. Read more
HeaderRowStyle - specify a style for the grid's header row. Read more
Here is a small sample, demonstrating the usage of some of the above properties.
CopyXAML
<telerik:RadGridView x:Name="radGridView"
RowIndicatorVisibility="Collapsed"
RowDetailsVisibilityMode="VisibleWhenSelected"
AlternationCount="2">
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<Border BorderThickness="2" Height="35">
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
</Border>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
</telerik:RadGridView>
You can see that the row indicators are missing and the row details are displayed only for the selected row. Moreover each even row has different styling because of the property AlternationCount.
Groups
This section covers the following properties:
ShowGroupFooters - show\hide the group footers, located at the bottom of each group.
ShowGroupPanel - show\hide the group panel, located at the top of the RadGridView control.
GroupRowStyle - specify a style for the group row. Read more
GroupFooterRowStyle - specify a style for the footer group row. Read more
Here is a small sample, demonstrating the usage of some of the above properties.
CopyXAML
<telerik:RadGridView x:Name="radGridView"
ShowGroupFooters="True"
ShowGroupPanel="False">
<telerik:RadGridView.GroupDescriptors>
<telerik:GroupDescriptor Member="Country">
</telerik:GroupDescriptor>
</telerik:RadGridView.GroupDescriptors>
</telerik:RadGridView>
You can see that the group footers are shown, while the group panel (located at the top of the RadGridView) is no longer visible, thus making any changes in the grouping impossible.
See Also