GridViewGroupPanelCell background unable to be changed

8 posts, 0 answers
  1. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 30 Aug 2012 Link to this post

    Hi,

    I recently upgrades a SL4 project from version 2010.2.812.1030 to 2012.2.725.1040, and it has cause an interesting problem. We have some styles on our controls, and one of them appears to have messed up the group panel cell.

    Left as they are, the group header disappears:

    http://tinypic.com/r/f1y0qo/6

    I realised that if I removed the template property in the GridViewGroupPanelItemStyle, I could get the text to come back but without the correct background.

    http://tinypic.com/r/2d5ft3/6

    Any thoughts?

    If this helps:

    <Style
            x:Key="GridViewGroupPanelItemStyle"
            TargetType="telerik:GridViewGroupPanelItem">
            <Setter
                Property="Template"
                Value="{StaticResource GridViewGroupPanelItemTemplate}"/>
            <Setter
                Property="Background"
                Value="Transparent" />
            <Setter
                Property="Padding"
                Value="2,0,2,2" />
            <Setter
                Property="VerticalContentAlignment"
                Value="Stretch" />
            <Setter
                Property="HorizontalContentAlignment"
                Value="Left" />
        </Style>

    <ControlTemplate
            x:Key="GridViewGroupPanelItemTemplate"
            TargetType="telerik:GridViewGroupPanelItem"
            >
            <StackPanel
                x:Name="PART_GroupPanelItemStackPanel"
                Orientation="Horizontal"
                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                Background="{TemplateBinding Background}"
                >
                <Grid
                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                    <Grid.RowDefinitions>
                        <RowDefinition
                            MinHeight="4"
                            Height="Auto"/>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Path
                        Name="PART_InsertionPoint"
                        Grid.Row="0"
                        Visibility="Collapsed"
                        Fill="{StaticResource GridView_IndicatorPrimaryColor}"
                        Stretch="Fill"
                        VerticalAlignment="Top"
                        HorizontalAlignment="Center"
                        Width="6.414"
                        Height="4.677"
                        Data="M206.66812,170.31108 L212.08199,170.31108 209.36058,173.98834 z" />
                    <Grid
                        x:Name="PART_ConnectingLine"
                        Visibility="Visible"
                        Grid.Row="1"
                        Margin="{TemplateBinding Padding}">
                        <Path
                            Fill="{StaticResource GridView_IndicatorSecondaryColor}"
                            Stretch="Fill"
                            Stroke="{x:Null}"
                            Width="4"
                            Height="7"
                            Data="M0,0 L1,0 1,1 2,1 2,2 3,2 3,3 4,3 4,4 3,4 3,5 2,5 2,6 1,6 1,7 0,7 z"
                            Margin="1,2,0,0" />
                        <Path
                            Fill="{StaticResource GridView_IndicatorPrimaryColor}"
                            Stretch="Fill"
                            Stroke="{x:Null}"
                            Width="4"
                            Height="7"
                            Data="M0,0 L1,0 1,1 2,1 2,2 3,2 3,3 4,3 4,4 3,4 3,5 2,5 2,6 1,6 1,7 0,7 z" />
                    </Grid>
                </Grid>
                <telerik:GridViewGroupPanelCell
                    Content="{Binding Path=DisplayContent}"
                    Style="{StaticResource GridViewGroupPanelCellStyle}"
                    SortDirection="{Binding Path=SortDirection}" />
            </StackPanel>
        </ControlTemplate>

    <Style
            x:Key="GridViewGroupPanelCellStyle"
            TargetType="telerik:GridViewGroupPanelCell">
            <Setter
                Property="Template"
                Value="{StaticResource GridViewGroupPanelCellTemplate}" />
            <Setter
                Property="Background"
                Value="{StaticResource EikosNavyBlueBrush}" />
            <Setter
                Property="BorderThickness"
                Value="1" />
            <Setter
                Property="BorderBrush"
                Value="{StaticResource GridView_HeaderOuterBorder}" />
            <Setter
                Property="Padding"
                Value="20,0" />
            <Setter
                Property="MinHeight"
                Value="24" />
            <Setter
                Property="VerticalContentAlignment"
                Value="Center" />
            <Setter
                Property="HorizontalContentAlignment"
                Value="Center" />
            <Setter
                Property="Foreground"
                Value="{StaticResource GridView_HeaderForeground}" />
        </Style>

  2. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 03 Sep 2012 Link to this post

    Telerik, any thoughts?
  3. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Sep 2012 Link to this post

    Hi Andrea,

    Could you verify whether all the bindings in the template are present and set correctly ? How do you get the template - do you extract it with Blend ? Which version are you working with ? 

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  4. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    Hi,

    Thanks for getting back to me. Good call on the binding! I narrowed it down to here:

    Content="{TemplateBinding Content}

    Any ideas as to why this has broken following the upgrade?

    I do not use Blend.

    Thanks.

  5. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 05 Sep 2012 Link to this post

    Hi,

    Just an update. I replaced our style with the original telerik one from in the dll, and it still doesn't work. Our style is the exact same as one in another project, which works perfectly with a slightly older version of telerik. Thoughts?

    Thanks.
  6. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 07 Sep 2012 Link to this post

    Hello Andrea,

    Could you try following the currently suggested approach for styling - using NoXAML binaries and creating implicit style ? Do you get the same behavior ?

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2012 Link to this post

    Unfortunately, the cell just refuses to change colour. It does mean I don't have to remove the template or content binding for the header text to appear though!

    After copying the style from the dll, changing the colour and following that guide, here is the style:

    <Style x:Key="GridViewGroupPanelCellStyle"
             TargetType="grid:GridViewGroupPanelCell"
             BasedOn="{StaticResource GridViewGroupPanelCellStyle}">
           <Setter Property="Template" Value="{StaticResource GridViewGroupPanelCellTemplate}"/>
           <Setter Property="Background" Value="#011B54"/>
           <Setter Property="BorderThickness" Value="1"/>
           <Setter Property="BorderBrush" Value="{StaticResource GridView_HeaderOuterBorder}"/>
           <Setter Property="Padding" Value="20,0"/>
           <Setter Property="MinHeight" Value="24"/>
           <Setter Property="VerticalContentAlignment" Value="Center"/>
           <Setter Property="HorizontalContentAlignment" Value="Center"/>
           <Setter Property="Foreground" Value="{StaticResource GridView_HeaderForeground}"/>
       </Style>

    Can anybody see why it's being ignored?
  8. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2012 Link to this post

    Hi,

    Just to update, I managed to fix this. For anybody else who has this problem, I changed:

    <telerik:GridViewGroupPanelCell
                    Content="{Binding Path=DisplayContent}"
                    Style="{StaticResource GridViewGroupPanelCellStyle}"
                    SortDirection="{Binding Path=SortDirection}" />
     To:

    <telerik:GridViewGroupPanelCell
                    Content="{TemplateBinding Content}"
                    Style="{StaticResource GridViewGroupPanelCellStyle}"
                    SortDirection="{Binding Path=SortDirection}" />

    Telerik, I appreciate your help. I do want to add though that I think you have some major problems in your JustDecompile program. It completely mangled your xaml files, which led me on a wild goose chase for the best part of two days. I would recommend anybody else to use .Net Reflector instead.
Back to Top