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

[Solved] AlternateRowStyle for Themes?

1 Answer 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Terry
Top achievements
Rank 1
Terry asked on 04 Sep 2009, 11:15 PM
Hi:

I've read in this forum that some of the standard themes have alternating row colors.  But they don't for me.  I'm defining the theme in app.xaml.cs:

 

 

            Telerik.Windows.Controls.StyleManager.ApplicationTheme   
                = new Telerik.Windows.Controls.Office_SilverTheme();  
 

I've tried setting the gridview's UseAlternateRowStyle="True" to no avail.

I've also tried the example I've seen in this forum to set the color directly, but I get a "Invalid attribute value radGridView:GridViewRow for property TargetType" error.  My code is:
<UserControl   
    x:Class="KPIControl.ReportGrid" 
    xmlns:radGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   
    > 
    <Grid x:Name="LayoutRoot" Background="White">  
        <radGridView:RadGridView x:Name="gvReport" ScrollViewer.HorizontalScrollBarVisibility="Visible" 
            ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollMode="Deferred"   
              
        > 
 
            <radGridView:RadGridView.Resources> 
                <Style x:Name="GridViewAlternateRowStyle" TargetType="radGridView:GridViewRow">  
                    <Setter Property="Background" Value="Red" /> 
                </Style> 
            </radGridView:RadGridView.Resources> 
            <radGridView:RadGridView.RowAppearance> 
                <radGridView:RowAppearanceSettings AlternateRowStyle="{StaticResource GridViewAlternateRowStyle}" /> 
            </radGridView:RadGridView.RowAppearance> 
 

Any help would be appreciated.  If there is a way to turn alternate lines on in the themes, I would prefer that as users will get a consistent look regardless of the theme they select.

Thanks in advance,

Terry

1 Answer, 1 is accepted

Sort by
0
Kalin Milanov
Telerik team
answered on 10 Sep 2009, 08:56 AM
Hi Terry,

All of our themes support row alternation for RadGridView. You can turn row alternation on by simply setting the UseAlternateRowStyle="True". When you do that the grid will automatically use the theme specific alternate row style and apply it.

I noticed you are experimenting with the Office_Silver theme and I am attaching you a sample application which uses row alternation and the silver theme.

Best wishes,
Kalin Milanov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Terry
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Share this question
or