No rotation


   
     
<Window x:Class="Workspace.DockExample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Workspace" Width="640" Height="480">
    <Polyline Points="25,25 0,50 25,75 50,50 25,25 25,0" Stroke="Blue" StrokeThickness="10"/> 

</Window>

   
    
    
    
    
     


Polygon Mouse down event


   
  
<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
    <StackPanel Orientation="Horizontal">
        <Polygon Fill="Red" Canvas.Left = "100" Canvas.Top="30" Points="20 0 40 40 0 40" MouseDown="Polygon_MouseDown"/>
    </StackPanel>
</Window>


//File:Window.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    public partial class ShapesWindow : Window
    {
        public ShapesWindow()
        {
            InitializeComponent();
        }

        private void Polygon_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("Hi");
        }
    }
}

   
    
     


Difference between EvenOdd FillRule and 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>

        <!-- Define properties common to both figures. -->

        <Style x:Key="figure">
            <Setter Property="Polygon.Points"
                Value="  0   0,   0 184, 184 144, 144  24,20 120, 120 300, 280 264, 964,  0" />
            <Setter Property="Polygon.Fill"
                    Value="Blue" />
            <Setter Property="Polygon.Stroke"
                    Value="Red" />
            <Setter Property="Polygon.StrokeThickness"
                    Value="3" />
        </Style>
    </Canvas.Resources>


    <TextBlock Canvas.Left="48" Canvas.Top="24"
               Text="FillRule = EvenOdd" />

    <Polygon Style="{StaticResource figure}"
             FillRule="EvenOdd"
             Canvas.Left="48" Canvas.Top="72" />


    <TextBlock Canvas.Left="360" Canvas.Top="24"
               Text="FillRule = NonZero" />

    <Polygon Style="{StaticResource figure}"
             FillRule="NonZero"
             Canvas.Left="360" Canvas.Top="72" />
</Canvas>

   
    
    
    
    
    
    
     


Polygon Stretch=None


   
     
<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="None"/>
  </Canvas>
</Page>