Mega Code Archive

 
Categories / Silverlight / UI Controls
 

Basic Template

<UserControl x:Class='SilverlightApplication3.MainPage'     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'      xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     xmlns:d='http://schemas.microsoft.com/expression/blend/2008'      xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'      mc:Ignorable='d'      d:DesignWidth='640'      d:DesignHeight='480'>     <Grid x:Name="LayoutRoot" Background="White">         <Grid.Resources>             <Style TargetType="Button" x:Key="StarButton">                 <Setter Property="Template">                     <Setter.Value>                         <ControlTemplate TargetType="Button">                             <Grid>                                 <Path Fill="Yellow">                                     <Path.Data>                                         <PathGeometry>                                             <PathFigure>                                                 <LineSegment Point="100,100" />                                                 <LineSegment Point="200, 100" />                                                 <LineSegment Point="250, 0" />                                                 <LineSegment Point="300, 100" />                                                 <LineSegment Point="400, 100" />                                                 <LineSegment Point="320, 200" />                                                 <LineSegment Point="400, 300" />                                                 <LineSegment Point="250, 270" />                                                 <LineSegment Point="100, 300" />                                                 <LineSegment Point="180, 200" />                                                 <LineSegment Point="100, 100" />                                             </PathFigure>                                         </PathGeometry>                                     </Path.Data>                                 </Path>                             </Grid>                         </ControlTemplate>                     </Setter.Value>                 </Setter>             </Style>         </Grid.Resources>         <Button Style="{StaticResource StarButton}" Content="Click Me" />     </Grid> </UserControl>