Draws a polygon, which is a connected series of lines that form a closed shape.
<Polygon .../>
AddEventListener , CaptureMouse, Equals, FindName (DependencyObject), GetHost, GetParent, GetValue, ReleaseMouseCapture, RemoveEventListener, SetValue
Canvas.Left , Canvas.Top, Canvas.ZIndex, Clip, Cursor, Effect (Silverlight 3), Fill (Shape), FillRule (Polygon), Grid.Column (Silverlight 2), Grid.ColumnSpan (Silverlight 2), Grid.Row (Silverlight 2), Grid.RowSpan (Silverlight 2), Height (UIElement), HorizontalAlignment (Silverlight 2), Margin (Silverlight 2), MaxHeight (Silverlight 2), MaxWidth (Silverlight 2), MinHeight (Silverlight 2), MinWidth (Silverlight 2), Name (DependencyObject), Opacity (UIElement), OpacityMask, Points (Polygon), Projection (Silverlight 3), RenderTransform, RenderTransformOrigin, Resources, Stretch (Shape), Stroke (Shape), StrokeDashArray, StrokeDashCap, StrokeDashOffset, StrokeEndLineCap, StrokeLineJoin, StrokeMiterLimit, StrokeStartLineCap, StrokeThickness, Style (Silverlight 2), Tag, Triggers, VerticalAlignment (Silverlight 2), Visibility, Width (UIElement)
Loaded , MouseEnter, MouseLeave, MouseLeftButtonDown, MouseLeftButtonUp, MouseMove, MouseWheel (Silverlight 3)
The simplest true polygon is a triangle, in which case the Points property will have three entries. A Polygon object with two Points values will still render as long as it has a nonzero StrokeThickness value and a non-null Stroke value, but you could accomplish that same result with a Line object. A Polygon that has only one point will not render.
The following example shows how to use a Polygon object to create a triangle.
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!-- This polygon shape uses predefined color values for its Stroke and Fill properties. The SolidColorBrush's Opacity property affects the fill color in this case by making it slightly transparent (opacity of 0.4) so that it blends with any underlying color. --> <Polygon Points="300,200 400,125 400,275 300,200" Stroke="Purple" StrokeThickness="2"> <Polygon.Fill> <SolidColorBrush Color="Blue" Opacity="0.4"/> </Polygon.Fill> </Polygon> </Canvas>
The following illustration shows the rendered shape.
