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

Custom Styling

2 Answers 145 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 13 Oct 2008, 01:37 PM
Greetings,
   I am attempting to do some custom styling based on the Simple theme.  I looked over the example provided on this post (http://www.telerik.com/community/forums/thread/b311D-bkeeck.aspx) however it does not work with the latest builds of the WPF gridview control.

Specifically I am having trouble styling the GridViewHeaderRow (or GridViewHeaderCell) and the row selectors (I haven't found the object name for these yet).

The following is a small piece of code from the styling: (Note the dark blue is for testing purposes, end goal is a gradient brush)
<Window x:Class="radGridStyling.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:radGrid="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:Simple="clr-namespace:Telerik.Windows.Controls.Simple;assembly=Telerik.Windows.Controls.Simple" 
    Title="Window1" Height="401" Width="654" > 
    <Window.Resources> 
        <Style TargetType="{x:Type radGrid:GridViewRow}" > 
            <Style.Triggers> 
                <DataTrigger Binding="{Binding IsAlternating}" Value="False"
                    <DataTrigger.Setters> 
                        <Setter Property="Background" Value="#ABD5F3" /> 
                    </DataTrigger.Setters> 
                </DataTrigger> 
                <DataTrigger Binding="{Binding IsAlternating}" Value="True"
                    <DataTrigger.Setters> 
                        <Setter Property="Background" Value="#CAEEFE" /> 
                    </DataTrigger.Setters> 
                </DataTrigger> 
            </Style.Triggers> 
        </Style> 
 
        <Style TargetType="{x:Type radGrid:GridViewHeaderRow}" > 
            <Setter Property="Background" Value="DarkBlue" /> 
        </Style> 
 
        <Style TargetType="{x:Type radGrid:GridViewHeaderCell}" > 
            <Setter Property="Background" Value="DarkBlue" /> 
        </Style> 
 
    </Window.Resources> 
     
    <Grid> 
        <radGrid:RadGridView Margin="26,22,79,43" Name="radGridView1" > 
            <radGrid:Theming.Theme> 
                <Simple:SimpleTheme/> 
            </radGrid:Theming.Theme> 
        </radGrid:RadGridView> 
    </Grid> 
</Window> 
 

In the example above, the GridViewRow style changes work as expected. However the GridViewHeaderRow and GridViewHeaderCell styles have no impact.

Any guidance would be greatly appreciated!

Thanks,
  Chris

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Dobrev
Telerik team
answered on 14 Oct 2008, 02:58 PM
Hi Christopher,

You selected the right approach to style your RadGridView control. Unfortunately, we have a few hard-coded values in our Simple theme and we had to change three of our templates a little. You can find these template in CustomTemplate.xaml in the attached sample. In it, we make then header cells transparent and we set the background of the whole header row. You are, of course, able to set the background of the header cells, if you wish.

Thank you for your question and for being active in our forum. It will be a pleasure for us to provide you with any further assistance you may need.

Greetings,
Dimitar Dobrev,
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Christopher
Top achievements
Rank 1
answered on 16 Oct 2008, 03:53 PM
Thanks much for the updated control templates!

I was able to complete my grid styling following your example.

I did notice that the GridViewNavigationCell and GridViewNavigationColumn appear to have the same hard coded values in the simple theme.  Following your example however I was able to create a new control template for the Navigation cell and then apply styling.

Thanks!
  Chris
Tags
GridView
Asked by
Christopher
Top achievements
Rank 1
Answers by
Dimitar Dobrev
Telerik team
Christopher
Top achievements
Rank 1
Share this question
or