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

Image as row background?

1 Answer 221 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kennet
Top achievements
Rank 2
Kennet asked on 26 May 2010, 07:48 AM
Now I have different colors as rowbackground depending on value in "category". but how can I use images (horizontal tiled) as background for my rows?

How I do it now:
 <Style x:Key="GridRowStyle" TargetType="telerik:GridViewRow" 
 
         <Style.Triggers> 
 
                <DataTrigger Binding="{Binding Path=category}" Value="1">  
            <Setter Property="Background" Value="#FFFF88" /> 
                </DataTrigger> 
 
    </Style.Triggers> 
</Style> 
 
//In grid I use:  
RowStyle="{StaticResource GridRowStyle}" 
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Kalin Milanov
Telerik team
answered on 26 May 2010, 12:20 PM
Hi Kennet,

You can use the following XAML to set an image brush as a background of the row, however the tiling is not working as intended and we will have to have a look at it. For now I suggest you use a wider image than you originaly intended to get results as close as you expect.

Here is the XAML:
<ImageBrush x:Key="RowBackgrondImage" ImageSource="icon.png" Opacity="1" Stretch="Fill" TileMode="Tile">
            <ImageBrush.RelativeTransform>
                <TransformGroup>
                    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1" ScaleY="1"/>
                    <SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/>
                    <RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/>
                    <TranslateTransform X="0" Y="0"/>
                </TransformGroup>
            </ImageBrush.RelativeTransform>
        </ImageBrush>
          
        <Style TargetType="{x:Type telerik:GridViewRow}">
            <Setter Property="Background" Value="{DynamicResource RowBackgrondImage}" />
        </Style>

Kind regards,
Kalin Milanov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Kennet
Top achievements
Rank 2
Answers by
Kalin Milanov
Telerik team
Share this question
or