Wednesday, 30 June 2010

Change Silverlight Border Background

Silverlighet Border is a strong control. It is widely used. To make Border stylish it has various properties to design accordingly.

<Border x:Name="bdrBody" Margin="12,71,20,16"  Visibility="Visible" CornerRadius="5,5,10,10" BorderThickness="4,1,1,1" BorderBrush="Blue" Padding="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="White" />
                    <GradientStop Color="Black" Offset="1"/>
            <Grid x:Name="grdMain" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
Here is an example of Border.
CornerRadius – Make border corner rounded.
BorderThickness – Make border side thickness bold or light.
BorderBrush – Change border rounded color.
Margin – To fix position of border.
We can give a button look and feel of a border by changing LinearGradientBrush property of Border.Background. Expression blend is the best way of changing border style. Manually changing GradientStop color and Offset value we can make border attractive. It can be use as container of another pages, here grdMain is used as a container.

No comments:

Post a Comment