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

Style a Row from Binding value

2 Answers 96 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kennet
Top achievements
Rank 2
Kennet asked on 30 Dec 2009, 11:49 AM
In MS ListView I did like this to set color/brush on a row with sertial "Category" value.

 <Window.Resources> 
        <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}">  
            <Style.Resources> 
                <LinearGradientBrush x:Key="Brush1" StartPoint="0.5,0" EndPoint="0.5,1">  
                    <GradientStop Offset="0.1" Color="#AA00CC00" /> 
                    <GradientStop Offset="0.8" Color="#55008800" /> 
                </LinearGradientBrush> 
                  
        <LinearGradientBrush x:Key="Brush2" StartPoint="0.5,0" EndPoint="0.5,1">  
                    <GradientStop Offset="0.1" Color="Orange" /> 
                    <GradientStop Offset="0.8" Color="OrangeRed" /> 
                </LinearGradientBrush> 
 
            </Style.Resources> 
 
 
            <Style.Triggers> 
                  
                <DataTrigger Binding="{Binding Path=Category}" Value="1">  
                    <Setter Property="Background" Value="{StaticResource Brush1}" /> 
                    <Setter Property="Height" Value="25"/>  
                </DataTrigger> 
                  
                <DataTrigger Binding="{Binding Path=Category}" Value="2">  
                    <Setter Property="Background" Value="{StaticResource Brush2}" /> 
                    <Setter Property="Height" Value="30"/>  
                </DataTrigger> 
                  
                 
            </Style.Triggers> 
        </Style> 
 
    </Window.Resources> 

In Listview
 <ListView x:Name="listView1" ItemContainerStyle="{StaticResource ItemContStyle}">  
<ListView.View> 
<GridView> 
 <GridViewColumn Header="Artist" DisplayMemberBinding="{Binding Path=Artist}" Width="310" /> 
<GridViewColumn Header="Title" DisplayMemberBinding="{Binding Path=Title}" Width="310" /> 
</GridView> 
</ListView.View> 
 </ListView> 

How can I applay the same method on RadGridView?

2 Answers, 1 is accepted

Sort by
0
Kennet
Top achievements
Rank 2
answered on 30 Dec 2009, 01:09 PM
OK, I solwed it

 

<Style x:Key="ItemContStyle" TargetType="telerik:GridViewRow"

 

 


and

 

<telerik:RadGridView RowStyle="{StaticResource ItemContStyle}" /> 

 

0
Accepted
Tsvyatko
Telerik team
answered on 30 Dec 2009, 01:36 PM
Hello Kennet,

Attached you will find a sample application demonstrating how you can achieve similar appearance of the RadGridView.

If you have any more questions do not hesitate to contact us.

Kind regards,
Tsvyatko
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
Kennet
Top achievements
Rank 2
Answers by
Kennet
Top achievements
Rank 2
Tsvyatko
Telerik team
Share this question
or