# Styling Group Panel

## Targeting the GridViewGroupPanel Element

In order to style all **RadGridView** group panels of an application, you should create an appropriate style targeting the **GridViewGroupPanel** 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.

> To modify the default style, see [Editing Control Templates](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-editing-control-templates).

**Example 1: Styling all group panels of an application**

```XAML
<Style TargetType="{x:Type telerik:GridViewGroupPanel}">
    <Setter Property="MinHeight" Value="50"/>
    <Setter Property="BorderThickness" Value="3"/>
</Style>
```

> If you're using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview), you should base your style on the **GridViewGroupPanelStyle**.

## Targeting the GridViewGroupPanelItem Element

You could also style all group panel items by creating a style, targeting the **GridViewPanelItem** element, like so:

**Example 2: Styling all group panel items of an application**

```XAML
<Style TargetType="{x:Type telerik:GridViewGroupPanelItem}">
    <Setter Property="Padding" Value="10"/>
    <Setter Property="FontSize" Value="20" />
</Style>
```

> If you're using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview), you should base your style on the **GridViewGroupPanelItemStyle**.

## Targeting the GridViewGroupPanelCell Element

The **GridViewGroupPanelItem** wraps the **GridViewGroupPanelCell** control, which represents the visual item in the **Group Panel**. If you want to style it, you should create the appropriate style, targeting the **GridViewGroupPanelCell** element.

**Example 3: Styling the GridViewGroupPanelCell element**

```XAML
<Style TargetType="{x:Type telerik:GridViewGroupPanelCell}">
    <Setter Property="Background" Value="Red" />
    <Setter Property="BorderBrush" Value="Yellow" />
    <Setter Property="BorderThickness" Value="2" />
</Style>
```

> If you're using [Implicit Styles](https://www.telerik.com/products/wpf/documentation/styling-and-appearance/styling-apperance-setting-a-theme-overview), you should base your style on the **GridViewGroupPanelCellStyle**.

## Setting RadGridView's GroupPanelStyle and GroupPanelItemStyle

**RadGridView** exposes two properties of type **Style** - **GroupPanelStyle** and **GroupPanelItemStyle**. They are applied to the **Group Panel** and its items.

**Example 4: Setting RadGridView's GroupPanelStyle and GroupPanelItemStyle**

```XAML
<telerik:RadGridView GroupPanelStyle="{StaticResource GroupPanelStyle}"
GroupPanelItemStyle="{StaticResource GroupPanelItemStyle}" />
```

> caption RadGridView with styled group panel

![Telerik UI for WPF RadGridView with custom GroupPanelStyle and GroupPanelItemStyle applied to the group panel](https://www.telerik.com/products/wpf/documentation/assets/fe99f8ea2b06056a1abb9b4ae6514dd9/radgridview_styles_and_templates_styling_radgridview_03.png)

## GroupPanelForeground and GroupPanelBackground

A simple way to change the group panel's foreground and background is through RadGridView's **GroupPanelForeground** and **GroupPanelBackground** properties. **Example 5** shows how this can be done.

**Example 5: Setting RadGridView's GroupPanelForeground and GroupPanelBackground**

```XAML
<telerik:RadGridView GroupPanelForeground="White"
GroupPanelBackground="Blue" />
```

## See Also

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

* [Basic Grouping](https://www.telerik.com/products/wpf/documentation/controls/radgridview/grouping/basics)
