<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
TextBlock.FontSize="16">
<Canvas.Resources>
<Style x:Key="figure">
<Setter Property="Polygon.Points"
Value="0 48, 0 144, 96 150, 100 0, 192 0, 192 96, 50 96, 48 192, 150 200 144 48" />
<Setter Property="Polygon.Fill"
Value="Black" />
<Setter Property="Polygon.Stroke"
Value="Yellow" />
<Setter Property="Polygon.StrokeThickness"
Value="3" />
</Style>
</Canvas.Resources>
<TextBlock Canvas.Left="288" Canvas.Top="24"
Text="FillRule = NonZero" />
<Polygon Style="{StaticResource figure}"
FillRule="NonZero"
Canvas.Left="288" Canvas.Top="72" />
</Canvas>
Month: February 2011
Draw second figure with “NonZero” FillRule
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
TextBlock.FontSize="16">
<Canvas.Resources>
<Style x:Key="star">
<Setter Property="Polygon.Points"
Value="0 -96, 56, 78, -91 -30, 91 -30, -56 78" />
<Setter Property="Polygon.Fill"
Value="Blue" />
<Setter Property="Polygon.Stroke"
Value="Red" />
<Setter Property="Polygon.StrokeThickness"
Value="3" />
</Style>
</Canvas.Resources>
<TextBlock Canvas.Left="288" Canvas.Top="24"
Text="FillRule = NonZero" />
<Polygon Style="{StaticResource star}"
FillRule="NonZero"
Canvas.Left="360" Canvas.Top="168" />
</Canvas>
Polygon Stretch= UniformToFill
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Graphics.RectangleExample"
WindowTitle="Rectangle Example">
<Canvas>
<Polygon Height="100" Width="50" Points="0,0 10,10 0,10" Fill="Blue" Stretch="UniformToFill"/>
</Canvas>
</Page>
Polygon Stretch=”Uniform
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Graphics.RectangleExample"
WindowTitle="Rectangle Example">
<Canvas>
<Polygon Height="100" Width="50" Points="0,0 10,10 0,10" Fill="Blue" Stretch="Uniform"/>
</Canvas>
</Page>
Star Polygon
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Graphics.RectangleExample"
WindowTitle="Example">
<Canvas>
<Polygon Name="star"
Stroke="Blue"
Fill="DarkOrange"
StrokeThickness="2.0"
Points="176,50 189,15 186,113 200,17 26,240 189,198 176,34 163,198 66,240 151,17 66,113 163,155">
</Polygon>
</Canvas>
</Page>
Fill Polygon with RadialGradientBrush
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Graphics.RectangleExample"
WindowTitle="Example">
<Canvas>
<Polygon Name="hexagon"
Stroke="Blue"
StrokeThickness="2.0"
Points="16,130 302,13 304,249 76,322 493,249 495,103">
<Polygon.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Gold" Offset="0.25" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Polygon.Fill>
</Polygon>
</Canvas>
</Page>
Polygon with Fill
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.Graphics.RectangleExample"
WindowTitle="Rectangle Example">
<Canvas>
<Polygon
Points="10,110 60,10 110,110"
Fill="#CCCCFF" />
</Canvas>
</Page>

