# Styling Cells

In this article, we discuss various approaches to style the RadGridView cells.

## Styling all RadGridView Cells

> The examples from this article assume that the RadGridView is set up as demonstrated in its [Getting Started](https://www.telerik.com/products/wpf/documentation/controls/radgridview/getting-started/getting-started2) article.

To style all `RadGridView` cells of an application, create a style that targets the `GridViewCell` element.

You have two options:

* To create an empty style and set it up on your own.

* To copy the default style of the control and [modify it](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-editing-control-templates).

**Styling all cells of an application**

```XAML
<Application.Resources>
       <ResourceDictionary>
           
           <Style TargetType="telerik:GridViewCell">
               <Setter Property="VerticalContentAlignment" Value="Top"/>
               <Setter Property="HorizontalContentAlignment" Value="Center"/>
               <Setter Property="Background" Value="#ffcc00"/>
           </Style>
       </ResourceDictionary>
   </Application.Resources>
```

> If you're using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview), base your style on the `GridViewCellStyle` that is defined for the corresponding theme.

> caption RadGridView with styled cells in the Office2016 theme

![Telerik UI for WPF RadGridView with custom styled cells in the Office2016 theme](https://www.telerik.com/products/wpf/documentation/assets/11f401b43371473e41f3e808c9b6fe76/radgridview-cell-styled.png)

## Setting a Column's CellStyle

You can also style **RadGridView Cells** by creating an appropriate `Style` for the `GridViewCell` element and setting it as the `CellStyle` property of the respective **GridView Column**.

**Setting a column's CellStyle**

```XAML
<Grid>
       <Grid.Resources>
           
           <Style x:Key="GridViewCellStyle" TargetType="telerik:GridViewCell">
               <Setter Property="VerticalContentAlignment" Value="Top"/>
               <Setter Property="HorizontalContentAlignment" Value="Center"/>
               <Setter Property="Background" Value="#ffcc00"/>
           </Style>
       </Grid.Resources>

       <telerik:RadGridView ItemsSource="{Binding Clubs}"
                            AutoGenerateColumns="False"
                            GroupRenderMode="Flat">
           <telerik:RadGridView.Columns>
               <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"
                Header="Name"
                CellStyle="{StaticResource GridViewCellStyle}" />
           </telerik:RadGridView.Columns>
       </telerik:RadGridView>
   </Grid>
```

## Setting a Column's CellStyleSelector

You could also use a column's `CellStyleSelector` property to style cells differently based on a specific condition. For more details about this approach, see the [CellStyleSelector article](https://www.telerik.com/products/wpf/documentation/controls/radgridview/style-selectors/cell-style-selector).

## Setting the SelectedBackground of the Cell

You can set the Background of the selected cell by setting the `SelectedBackground` property of the GridViewCell element.

**Setting the SelectedBackground of the GridViewCell**

```XAML
<Application.Resources>
       <ResourceDictionary>
           
           <Style TargetType="telerik:GridViewCell">
               <Setter Property="SelectedBackground" Value="Bisque" />
           </Style>
       </ResourceDictionary>
   </Application.Resources>
```

> caption Result when setting the SelectedBackground property in the Office2016 theme

![Telerik UI for WPF RadGridView showing a custom SelectedBackground on grid cells](https://www.telerik.com/products/wpf/documentation/assets/1bf4cd36a78fe529d8748247b0baf1c9/gridview-selectedbackground-cell.png)

## Setting the BorderBrush of the CurrentCell

You can set the BorderBrush of the current cell, by setting the `CurrentBorderBrush` property of the GridViewCell.

The following example demonstrates how to set the BorderBrush of the current cell to transparent.

**Setting the CurrentBorderBrush of the GridViewCell**

```XAML
<Application.Resources>
       <ResourceDictionary>
           
           <Style TargetType="telerik:GridViewCell">
               <Setter Property="CurrentBorderBrush" Value="Transparent" />
           </Style>
       </ResourceDictionary>
   </Application.Resources>
```

> caption Result when setting the CurrentBorderBrush property in the Office2016 theme

![Telerik UI for WPF RadGridView with the current cell border brush set to transparent](https://www.telerik.com/products/wpf/documentation/assets/688a615b29604948ccdcfad8c3403f26/gridview-currentborderbrush.png)

> After you have set the `CurrentBorderBrush` to `Transparent`, if you start navigating through the cells with the keyboard, you will be able to see the FocusVisual border. If you want to hide it as well, you can set the `FocusVisualStyle` of the GridViewCell to null through a style similar to the above example.

## Setting the MouseOverBackground of the Cell

You can change the MouseOver Background of the cells through the `MouseOverBackground` property of the GridViewCell. This is demonstrated in the following example.

**Setting the MouseOverBackground of the GridViewCell**

```XAML
<Application.Resources>
       <ResourceDictionary>
           
           <Style TargetType="telerik:GridViewCell" >
               <Setter Property="MouseOverBackground" Value="Pink" />
           </Style>
       </ResourceDictionary>
   </Application.Resources>
```

> caption Result when setting the MouseOverBackground property in the Office2016 theme

![Telerik UI for WPF RadGridView with a custom MouseOverBackground applied to cells](https://www.telerik.com/products/wpf/documentation/assets/69e7bbe24c91c15c1d3d123c3df0dc1f/gridviewcell-mouseoverbackground.png)

> In order for the MouseOverBackground of the cell to take effect, set the [SelectionUnit](https://www.telerik.com/products/wpf/documentation/controls/radgridview/selection/basics#selection-units) of RadGridView to `Mixed` or `Cell`.

## Setting the HighlightedBackground of the Cell

You can change the highlighted background color of a matched `GridViewCell` element when search as you type is performed. This color can be modified through the `HighlightedBackground` property.

**Setting the HighlightedBackground of the GridViewCell**

```XAML
<Application.Resources>
    <ResourceDictionary>
        
        <Style TargetType="telerik:GridViewCell" >
            <Setter Property="HighlightedBackground" Value="Pink"/>
        </Style>
    </ResourceDictionary>
</Application.Resources>
```

> caption Result when setting the HighlightedBackground property in the Office2016 theme

![Telerik UI for WPF RadGridView with a custom HighlightedBackground for matched search cells](https://www.telerik.com/products/wpf/documentation/assets/56e321e107103a9f56df22044befd56f/gridviewcell-matched-highlighted-background.png)

## See Also

* [Styling the GridViewEditorPresenter](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-editorpresenter)

* [Styling the Column Footers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-column-footers)

* [Styling the Column Headers](https://www.telerik.com/products/wpf/documentation/controls/radgridview/styles-and-templates/styling-column-headers)

* [Change Background for Disabled Grid Elements](https://www.telerik.com/products/wpf/documentation/controls/radgridview/how-to/set-background-disabled-cell)
