I am trying to apply a GroupPanelItemStyle to a grid, but nothing is happening when I apply the style. I have tried something as simple as this:
<
Style
x:Key
=
"GridViewGroupPanelItemStyle"
TargetType
=
"telerik:GridViewGroupPanelItem"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Green"
/>
</
Style
>
<
Style
x:Key
=
"RadGridViewDefaultStyle"
TargetType
=
"telerik:RadGridView"
>
<
Setter
Property
=
"GroupPanelItemStyle"
Value
=
"{StaticResource GridViewGroupPanelItemStyle}"
/>
</
Style
>
Am i missing something?
Thanks
Henrik
7 Answers, 1 is accepted
I would suggest you to use GridViewGroupPanelCell instead. See the code bellow:
<
Style
TargetType
=
"telerik:GridViewGroupPanelCell"
>
<
Setter
Property
=
"Background"
Value
=
"Red"
/>
<
Setter
Property
=
"Foreground"
Value
=
"Green"
/>
</
Style
>
Greetings,
Vera
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thank you very much for your reply.
Sorry but the suggested code has no effect. Even if I remove my style for the grid and only keeps this code nothings happens.
Any other ideas?
Thanks
Henrik
<
ControlTemplate
x:Key
=
"GridViewGroupPanelItemTemplate"
TargetType
=
"telerik:GridViewGroupPanelItem"
>
<
TextBlock
Text
=
"Test"
/>
</
ControlTemplate
>
<
Style
x:Key
=
"GridViewGroupPanelItemStyle"
TargetType
=
"telerik:GridViewGroupPanelItem"
>
<
Setter
Property
=
"Template"
Value
=
"{StaticResource GridViewGroupPanelItemTemplate}"
/>
</
Style
>
<
Style
x:Key
=
"RadGridViewDefaultStyle"
TargetType
=
"telerik:RadGridView"
>
<
Setter
Property
=
"GroupPanelItemStyle"
Value
=
"{StaticResource GridViewGroupPanelItemStyle}"
/>
</
Style
>
I have tested this and it seems to be working fine on my side. Would you please refer to the attached test project and tell us whether there are any relevant differences between your approach and mine.
All the best,Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thank you for your reply. I have tried you example and it is working as expected. But if you add the Telerik.Windows.Themes.Windows8 assembly and add this line to App.xaml
Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Windows8Theme();
You will get the same behaviour as I have. The theme is overriding the style,
Any ideas?
Thanks
Henrik
Unfortunately this is not supported when a theme different from OfficeBlack is applied through the StyleManager approach. I would propose you to use our new ImplicitStyles-based theming mechanism, which overcomes a lot of former problems and is quite easier for customizations. Here is a help article on this matter.
Kind regards,Ivan Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks
Henrik