Two of the drawing's rectangles are painted with an ImageBrush, creating a checkered pattern of images


   
     

<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">

      <Rectangle Width="50" Height="50" Grid.Row="0" Grid.Column="1">
        <Rectangle.Fill>
          <VisualBrush Viewport="0,0,1,0.25" TileMode="Tile" Stretch="Uniform">
            <VisualBrush.Visual>
              <StackPanel Background="White">
                <TextBlock FontSize="10pt" Margin="1">Hello, World!</TextBlock>
              </StackPanel>
            </VisualBrush.Visual>
          </VisualBrush>
        </Rectangle.Fill>
      </Rectangle>


</Window>

   
    
    
    
    
     


Fill rectangle with Rectangle.Fill tag and LinearGradientBrush


   
     
<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">
    <Canvas>

        <Rectangle Canvas.Left = "40" Canvas.Top="40" Width="40" RadiusX="10" RadiusY="10">
            <Rectangle.Fill>
                <LinearGradientBrush>
                    <GradientStop Offset="0" Color="Blue"/>
                    <GradientStop Offset=".8" Color="Yellow"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

    </Canvas>
</Window>

   
    
    
    
    
     


Pulsating Rectangle


   
     

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Rectangle Name="rect"
               Canvas.Left="96" Canvas.Top="96" 
               Width="192" Height="192"
               Stroke="Black">

    </Rectangle>

    <Canvas.Triggers>
        <EventTrigger RoutedEvent="Canvas.Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="rect"
                                     Storyboard.TargetProperty="Width"
                                     From="192" To="204" Duration="0:0:0.1"
                                     AutoReverse="True"
                                     RepeatBehavior="Forever" />

                    <DoubleAnimation Storyboard.TargetName="rect"
                                     Storyboard.TargetProperty="Height"
                                     From="192" To="204" Duration="0:0:0.1"
                                     AutoReverse="True"
                                     RepeatBehavior="Forever" />

                    <DoubleAnimation Storyboard.TargetName="rect"
                                     Storyboard.TargetProperty="(Canvas.Left)"
                                     From="96" To="90" Duration="0:0:0.1"
                                     AutoReverse="True"
                                     RepeatBehavior="Forever" />

                    <DoubleAnimation Storyboard.TargetName="rect"
                                     Storyboard.TargetProperty="(Canvas.Top)"
                                     From="96" To="90" Duration="0:0:0.1"
                                     AutoReverse="True"
                                     RepeatBehavior="Forever" />


                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Canvas.Triggers>
</Canvas>

   
    
    
    
    
     


Rounded Rectangle Corner radius of 5


   
     

<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>
    <TextBlock Margin="5,5,0,0">Corner radius of 5.</TextBlock>
    <Rectangle Fill="Yellow" Stroke="Blue" RadiusX="5" RadiusY="5"
               Width="100" Height="60" Margin="5"  HorizontalAlignment="Left">
    </Rectangle>

  </Canvas>
</Page>

   
    
    
    
    
     


Rounded Rectangle Corner radius of 10 (X) and 25 (Y)


   
     

<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>
  <TextBlock Margin="5,5,0,0">Corner radius of 10 (X) and 25 (Y).</TextBlock>
    <Rectangle Fill="Yellow" Stroke="Blue" RadiusX="10" RadiusY="25"
               Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"></Rectangle>

  </Canvas>
</Page>

   
    
    
    
    
     


Rounded Rectangle Corner radius of 100 (X) and 60 (Y)


   
     

<Window x:Class="Drawing.RoundedRectangles"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="RoundedRectangles" Height="449" Width="340"
    >
  <StackPanel>


    <TextBlock Margin="5,5,0,0">Corner radius of 100 (X) and 60 (Y).</TextBlock>
    <Rectangle Fill="Yellow" Stroke="Blue" RadiusX="100" RadiusY="60"
               Width="100" Height="60" Margin="5"  HorizontalAlignment="Left"></Rectangle>
  </StackPanel>
</Window>