How Do I apply a GroupPanelItemStyle?

8 posts, 0 answers
  1. Henrik Skak Pedersen
    Henrik Skak Pedersen avatar
    16 posts
    Member since:
    Nov 2006

    Posted 11 Dec 2012 Link to this post

    Hi,

    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
  2. Vera
    Admin
    Vera avatar
    268 posts

    Posted 11 Dec 2012 Link to this post

    Hi Henrik,

     
    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.

  3. Henrik Skak Pedersen
    Henrik Skak Pedersen avatar
    16 posts
    Member since:
    Nov 2006

    Posted 11 Dec 2012 Link to this post

    Hi Vera,

    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
  4. Henrik Skak Pedersen
    Henrik Skak Pedersen avatar
    16 posts
    Member since:
    Nov 2006

    Posted 12 Dec 2012 Link to this post

    Just a short update, I have tried to to like below as well. But it has no effect at all. I would expect test to be written in the items.

    <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>
  5. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1218 posts

    Posted 14 Dec 2012 Link to this post

    Hi,

    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.

  6. Henrik Skak Pedersen
    Henrik Skak Pedersen avatar
    16 posts
    Member since:
    Nov 2006

    Posted 14 Dec 2012 Link to this post

    Hi Ivan,

    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

  7. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1218 posts

    Posted 14 Dec 2012 Link to this post

    Hello,

    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.

  8. Henrik Skak Pedersen
    Henrik Skak Pedersen avatar
    16 posts
    Member since:
    Nov 2006

    Posted 14 Dec 2012 Link to this post

    Ok, thank you I will try that.

    Thanks
    Henrik
Back to Top