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

Column Groups lost when styling GridViewHeaderRow

5 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew Kruczek
Top achievements
Rank 1
Matthew Kruczek asked on 08 May 2012, 04:16 PM
Good morning,

I am trying to style the GridViewHeaderRow.  The first thing I did was copy the exact template via blend as your instructions have directed me to do.  Currently the only thing I'm changing is background color, as shown below.  As soon as I do that I lose the Column groups that I have created.  Any ideas?
<ResourceDictionary
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik1="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls">
 
 
    <SolidColorBrush x:Key="GridView_HeaderInnerBorder" Color="#FF4B4B4B"/>
    <Controls:Office_BlackTheme x:Key="Theme"/>
    <DataTemplate x:Key="GridViewHeaderIndentCellDataTemplate">
        <telerik1:GridViewHeaderIndentCell Controls:StyleManager.Theme="{StaticResource Theme}"/>
    </DataTemplate>
    <Controls:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    <ControlTemplate x:Key="GridViewHeaderRowTemplate" TargetType="telerik1:GridViewHeaderRow">
        <telerik1:SelectiveScrollingGrid>
            <telerik1:SelectiveScrollingGrid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </telerik1:SelectiveScrollingGrid.ColumnDefinitions>
            <Border x:Name="PART_GridViewHeaderRowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder}" BorderThickness="1" Background="{TemplateBinding Background}"/>
            </Border>
            <telerik1:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" Controls:StyleManager.Theme="{StaticResource Theme}"/>
            <Border x:Name="PART_IndicatorPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,1" telerik1:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" Width="25">
                <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder}" BorderThickness="1" Background="{TemplateBinding Background}"/>
            </Border>
            <telerik1:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" ItemTemplate="{StaticResource GridViewHeaderIndentCellDataTemplate}" IndentLevel="{TemplateBinding IndentLevel}" MinHeight="{TemplateBinding MinHeight}" telerik1:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Controls:StyleManager.Theme="{StaticResource Theme}"/>
            <Border x:Name="PART_HierarchyIndentPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,1" Grid.Column="2" telerik1:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" Width="25">
                <Border BorderBrush="{StaticResource GridView_HeaderInnerBorder}" BorderThickness="1" Background="{TemplateBinding Background}"/>
            </Border>
        </telerik1:SelectiveScrollingGrid>
    </ControlTemplate>
    <LinearGradientBrush x:Key="GridView_HeaderBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF5B5B5B" Offset="1"/>
        <GradientStop Color="#FF868686"/>
        <GradientStop Color="#FF4F4F4F" Offset="0.42"/>
        <GradientStop Color="#FF0E0E0E" Offset="0.43"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="GridView_HeaderOuterBorder" Color="#FF848484"/>
    <Style x:Key="TelerikHeaderRow" TargetType="telerik1:GridViewHeaderRow">
        <Setter Property="Template" Value="{StaticResource GridViewHeaderRowTemplate}"/>
        <Setter Property="Background" Value="#0083ac"/>
        <!--<Setter Property="Background" Value="{StaticResource GridView_HeaderBackground}"/>-->
        <Setter Property="MinHeight" Value="27"/>
        <Setter Property="BorderBrush" Value="{StaticResource GridView_HeaderOuterBorder}"/>
        <Setter Property="BorderThickness" Value="1,0,0,1"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Padding" Value="0"/>
    </Style>
 
</ResourceDictionary>

5 Answers, 1 is accepted

Sort by
0
Matthew Kruczek
Top achievements
Rank 1
answered on 08 May 2012, 07:47 PM
Just reconfirmed this bug using the Telerik Grid View demo code.  Please someone reply?
0
Vlad
Telerik team
answered on 09 May 2012, 07:36 AM
Hello,

 Can you post more info about the demo code you are referring? 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew Kruczek
Top achievements
Rank 1
answered on 09 May 2012, 01:00 PM
http://demos.telerik.com/silverlight/#GridView/MergedColumnHeaders
0
Vanya Pavlova
Telerik team
answered on 09 May 2012, 01:29 PM
Hello Matthew,

 

Looking at your code by some reason the CommonHeaderPresenter, which is responsible for displaying CommonColumnHeaders is missing. I have prepared small repro project which contains the default template of GridViewHeaderRow, modified its Background and everything works fine. 
Will you please take a look at the attached app and let me know how it goes?  



Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Matthew Kruczek
Top achievements
Rank 1
answered on 09 May 2012, 02:19 PM
That seemed to fix it!  yay!

While I have your ear, is there any way I can put a button on the Column Groups box?  Basically I want to be able to collapse the group down to one column and then uncollapse it as well.
Tags
GridView
Asked by
Matthew Kruczek
Top achievements
Rank 1
Answers by
Matthew Kruczek
Top achievements
Rank 1
Vlad
Telerik team
Vanya Pavlova
Telerik team
Share this question
or