custom grid style in silverlight 4

Posted by Archie on Stack Overflow See other posts from Stack Overflow or by Archie
Published on 2010-05-20T11:53:25Z Indexed on 2010/05/20 16:30 UTC
Read the original article Hit count: 268

Hello,

I want to set background of a grid using a style. I style I'm setting the Background Property of the grid.

But I have a border filled with LinearGradientFill and a Path which also has LinearGradientFill in it.

But I'm not able to combine both.

Below is sample code. I want to create it as a style.

<Grid>
<Border BorderBrush="Black" BorderThickness="2">
                <Border.Background>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="Black" Offset="0.953" />
                        <GradientStop Color="White" Offset="0" />
                    </LinearGradientBrush>
                </Border.Background>
            </Border>
            <Path Data="M 0,0 C 0,620 10,10 560,0" Height="60" VerticalAlignment="Top">
                <Path.Fill>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="Black" Offset="0" />
                        <GradientStop Color="White" Offset="0.779" />
                    </LinearGradientBrush>
                </Path.Fill>
            </Path>
</Grid>

It gives me an error as The Property 'Value' is set more than once.

Can anyone help me with it? Thanks.

© Stack Overflow or respective owner

Related posts about style

Related posts about custom