Posted by: Zeeshan Amjad | December 10, 2009

Little fun with Border


Today we are going to do little fun with Border control. We can set the individual corner of the border. In addition, we can also set the gradient as a background color. Here is a XAML file for this.

  1: <Window x:Class="WpfBorderExample.Window1"
  2:     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3:     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4:     Title="Fun with Border" Height="300" Width="300">
  5:     <Grid>
  6:         <Border Margin="10" CornerRadius="0, 200, 0, 0">
  7:             <Border.Background>
  8:                 <LinearGradientBrush>
  9:                     <GradientStop Offset="0" Color="DarkBlue"/>
 10:                     <GradientStop Offset="0.5" Color="White"/>
 11:                     <GradientStop Offset="1" Color="DarkBlue"/>
 12:                 </LinearGradientBrush>
 13:             </Border.Background>            
 14:         </Border>           
 15:     </Grid>
 16: </Window>
 17: 

This is the output of the program.

WpfBorder

Advertisements

Responses

  1. […] have already saw one example of border here. Now we are going to apply the gradient on border of the border control. At the same time we are […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: