This is a migrated thread and some comments may be shown as answers.

How do I style the cells in the Group Panel?

4 Answers 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 05 Oct 2012, 03:39 AM

Hi, I'm trying to change the background color of the cells shown in a RadGridView GroupPanel, using the Metro theme.

After reading the documentation I tried this approach:

<UserControl
    x:Class="SampleApp.MainPage"
 
    <UserControl.Resources>
        <Style x:Key="MyGroupPanelItemStyle" TargetType="telerik:GridViewGroupPanelItem">
            <Setter Property="Background" Value="Red" />
            <Setter Property="Foreground" Value="Green" />
        </Style>
    </UserControl.Resources>
     
    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
 
        <telerik:RadGridView
            ShowGroupPanel="True"
            AutoGenerateColumns="True"
            ItemsSource="{Binding Items}"
            GroupPanelItemStyle="{StaticResource MyGroupPanelItemStyle}" />
    </Grid>
</UserControl>

But this doesn't work - the style doesn't appear to be applied at all.

How do I target the style of these items? What am I missing?

Thanks,

Sam

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 05 Oct 2012, 05:31 AM
Hi,

 How this Metro theme is applied? Are you using implicit themes? If this is the case you need to specify BasedOn for your style.

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sam
Top achievements
Rank 1
answered on 05 Oct 2012, 05:39 AM
At the moment I'm just using a sample application that has a direct reference to the Metro theme DLL. I just want to be able to change the colour in this sample app first.

Also, we can't use implicit themes in our application - what's the simplest way to style the GroupPanel cells without requiring an implicit theme?
0
Accepted
Yordanka
Telerik team
answered on 10 Oct 2012, 06:32 AM
Hi Sam,

In order to apply style you should target GridViewGroupPanelCell as follow:

<Style TargetType="telerik:GridViewGroupPanelCell">
            <Setter Property="Background" Value="Red" />
            <Setter Property="Foreground" Value="Green" />
        </Style>

However, when a theme different from the default Office_Black is applied there is an issue and this style will not be applied. The problem is logged as PITS 12577 where you can vote and track the progress. 

This style will work if you use implicit theme. I am attaching sample project for a reference.

Kind regards,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sam
Top achievements
Rank 1
answered on 10 Oct 2012, 11:47 PM
Thanks Yordanka, looks like it's a bug for now as we can't use implicit themes or the default theme.

Hope it gets resolved soon!

Thanks,

Sam


Tags
GridView
Asked by
Sam
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Sam
Top achievements
Rank 1
Yordanka
Telerik team
Share this question
or