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

Need help changing the GridViewGroupFooterCell style

1 Answer 72 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 31 Jul 2012, 08:39 PM
I've tried to do this with Expression Blend and I've had no luck.

I have a form in my WPF application which contains a RadGridView.  I've defined Group Aggregates for the grid:

<telerik:RadGridView AlternationCount="1"
                     AutoExpandGroups="False"
                     AutoGenerateColumns="False"
                     CanUserDeleteRows="False"
                     CanUserFreezeColumns="False"
                     CanUserInsertRows="False"
                     CanUserResizeColumns="True"
                     CanUserSortColumns="True"
                     DataLoadMode="Synchronous"
                     EnableColumnVirtualization="True"
                     EnableRowVirtualization="True"
                     FontSize="16"
                     FontWeight="Bold"
                     Grid.Column="0"
                     Grid.Row="0"
                     IsReadOnly="True"
                     Name="HotListGrid"
                     ScrollViewer.CanContentScroll="True"
                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                     SelectionChanged="HotListGrid_SelectionChanged"
                     SelectionUnit="FullRow"
                     ShowColumnFooters="True"
                     ShowGroupPanel="False"
                     ToolTip="Hot Lists">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding Name      , Mode=OneWay}"
                                     Header="Hot List"
                                     Width="323">
            <telerik:GridViewDataColumn.AggregateFunctions>
                <telerik:CountFunction Caption="Count: " ResultFormatString="{}{0:n0}" />
            </telerik:GridViewDataColumn.AggregateFunctions>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding ListType  , Mode=OneWay}"
                                     Header="List Type"
                                     Width="Auto" />
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding LastUpdate, Mode=OneWay, Converter={StaticResource DateConverter}}"
                                     Header="Last Update"
                                     Width="200" />
        <telerik:GridViewImageColumn DataMemberBinding="{Binding Status    , Mode=OneWay, Converter={StaticResource DeviceStatuses}}"
                                     Header="Status"
                                     ImageStretch="None"
                                     Width="95" />
        <telerik:GridViewDataColumn  Header="Entries"
                                     TextAlignment="Right"
                                     Width="135">
            <telerik:GridViewDataColumn.DataMemberBinding>
                <Binding Path="EntryCount"
                         Mode="OneWay"
                         Converter="{StaticResource LongConverter}"
                         ConverterParameter="#,##0" />
            </telerik:GridViewDataColumn.DataMemberBinding>
            <telerik:GridViewDataColumn.AggregateFunctions>
                <telerik:SumFunction ResultFormatString="{}{0:n0}" />
            </telerik:GridViewDataColumn.AggregateFunctions>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

My application runs in police cars and has a "night mode" which changes the color pallette.  The problem is that the gradient brush used to draw the background of the Group Footer Row is not going away, so I have a light foreground color on a light background color in night mode that is difficult to read.

I have tried to edit the template for the GridViewGroupFooterRowStyle element in Expression Blend with no luck.  The gradient used in the background is not going away, even with this xaml in the app.xaml:

<Style TargetType="{x:Type telerik:GridViewGroupFooterRow}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:GridViewGroupFooterRow}">
                <Border x:Name="PART_GroupFooterRowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                    <telerik:SelectiveScrollingGrid>
                        <telerik:SelectiveScrollingGrid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </telerik:SelectiveScrollingGrid.ColumnDefinitions>
                        <Border x:Name="PART_IndicatorPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,0" Grid.Column="0" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
                            <Border BorderBrush="White" BorderThickness="1" Background="#FFE4E4E4"/>
                        </Border>
                        <Border x:Name="PART_HierarchyIndent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,0" Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25">
                            <Border.Visibility>
                                <Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                        <telerik:BooleanToVisibilityConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </Border.Visibility>
                        </Border>
                        <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" IsTabStop="False" />
                        <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" IsTabStop="False" IndentLevel="{TemplateBinding IndentLevel}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
                            <telerik:IndentPresenter.ItemTemplate>
                                <DataTemplate>
                                    <telerik:GridViewGroupFooterIndentCell IsTabStop="False">
                                        <telerik:StyleManager.Theme>
                                            <telerik:Office_BlackTheme/>
                                        </telerik:StyleManager.Theme>
                                    </telerik:GridViewGroupFooterIndentCell>
                                </DataTemplate>
                            </telerik:IndentPresenter.ItemTemplate>
                            <telerik:StyleManager.Theme>
                                <telerik:Office_BlackTheme/>
                            </telerik:StyleManager.Theme>
                        </telerik:IndentPresenter>
                    </telerik:SelectiveScrollingGrid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Background" Value="{DynamicResource DataHeaderBackground}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource DataBorder}"/>
    <Setter Property="MinHeight" Value="25"/>
    <Setter Property="BorderThickness" Value="0,0,0,1"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Foreground" Value="{DynamicResource DataHeaderForeground}"/>
</Style>

How do I get rid of that gradient?

1 Answer, 1 is accepted

Sort by
0
Tony
Top achievements
Rank 1
answered on 31 Jul 2012, 08:57 PM
Never mind.  I used Snoop to look at the visual tree and where the footer row was getting its background value from.  I found that it was the PART_FooterRow of type GridViewFooterRow.  I added a style for that type and the colors changed. 

Tony
Tags
GridView
Asked by
Tony
Top achievements
Rank 1
Answers by
Tony
Top achievements
Rank 1
Share this question
or