Search code examples
windows-8winrt-xamlexpression-blendblend

Styling Rectangle or Path in windows 8


Rectangle or path image

Is it possible to style a rectangle or path like this(Image given "Cylindrical Image" w.o the line behind).You can notice a cylindrical 3D effect in that image. In my application i cant apply a default background image to my control. I need to use the color that is given by the use. I tried to create this in blend. But unfortunately I can't get that 3D effect. Also i can't find a method to give gradient effect vertical plane. I think someone with expertise in Blend and design can help me. I found something similar to my question here in Stackoverflow But that solution didn't solve my issue.

Thanks in advance.

Stephan


Solution

  • You can accomplish this by using a LinearGradientBrush.

    <Rectangle Width="100">
        <Rectangle.Fill>
            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="#FF2F3243" Offset="1"/>
                <GradientStop Color="#FF5B5E6D" Offset="0.5"/>
                <GradientStop Color="#FF2F3243"/>
            </LinearGradientBrush>
        </Rectangle.Fill>
    </Rectangle>