Monthly Archives: January 2011

How to Create Irregular Shape Controls Silverlight

To draw the irregular shape objects in Silverlight we can use the Polygon and Path. Polygon has multiple points separated by space. Using these points we can draw any shape. The other option is the path. Using path its easy to draw a curve and irregular objects.

Below XAML will draw two objects.

 Width=”640″ Height=”480″ >

 <Grid x:Name=”LayoutRoot”>
   <LinearGradientBrush EndPoint=”0.5,1″ StartPoint=”0.5,0″>
    <GradientStop Color=”Black” Offset=”0″/>
    <GradientStop Color=”#FF4B1818″ Offset=”1″/>
  <Polygon Points=”40,100 40,200 200,200 200,130 150,100″ Fill=”Orange”></Polygon>
  <Path Data=”M415,57 L413,143 L483,142 L484,76 L454,56 z” Fill=”#FFF4F4F5″ Margin=”0,131.5,30.5,38.5″ Stretch=”Fill” Stroke=”Black” UseLayoutRounding=”False” HorizontalAlignment=”Right” Width=”282″/>