<!-- <SnippetTileBrushAlignmentExample> -->
<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Alignment Example"
  Background="White" Margin="20">
  <StackPanel>

    <!-- <SnippetTileBrushTopLeftAlignmentInline> -->
    <Rectangle
      Width="150" Height="150"
      Stroke="Red" StrokeThickness="2"
      Margin="20">
      <Rectangle.Fill>

        <!-- This brush's content is aligned to the top-left
             of its tile. -->
        <DrawingBrush  
          Stretch="None"
          AlignmentX="Left"
          AlignmentY="Top">
          <DrawingBrush.Drawing>
            <GeometryDrawing Brush="MediumBlue">
              <GeometryDrawing.Geometry>
                <GeometryGroup>
                  <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
                  <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
                </GeometryGroup>
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>
                <Pen Brush="Gray" Thickness="10" />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Rectangle.Fill>
    </Rectangle>
    <!-- </SnippetTileBrushTopLeftAlignmentInline> -->

    <!-- <SnippetTileBrushBottomRightAlignmentInline> -->
    <Rectangle
      Width="150" Height="150"
      Stroke="Red" StrokeThickness="2"
      Margin="20">
      <Rectangle.Fill>

        <!-- This brush's content is aligned to the bottom right
             of its tile. -->
        <DrawingBrush 
          Stretch="None"
          AlignmentX="Right"
          AlignmentY="Bottom">
          <DrawingBrush.Drawing>
            <GeometryDrawing Brush="MediumBlue">
              <GeometryDrawing.Geometry>
                <GeometryGroup>
                  <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
                  <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
                </GeometryGroup>
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>
                <Pen Brush="Gray" Thickness="10" />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Rectangle.Fill>
    </Rectangle>
    <!-- </SnippetTileBrushBottomRightAlignmentInline> -->

    <!-- Tiled Alignment Examples
         The next two examples show the effect of the AlignmentX
         and AlignmentY properties on a tiled TileBrush. -->
    
    <!-- <SnippetTileBrushTopLeftAlignmentTiledInline> -->
    <Rectangle
     Width="150" Height="150"
     Stroke="Black" StrokeThickness="2"
     Margin="20">
      <Rectangle.Fill>

        <!-- This brush's content is aligned to the top left
             of its tile.  -->
        <DrawingBrush 
          Stretch="Uniform"
          Viewport="0,0,0.25,0.5"
          TileMode="Tile" 
          AlignmentX="Left"
          AlignmentY="Top">
          <DrawingBrush.Drawing>
            <GeometryDrawing Brush="MediumBlue">
              <GeometryDrawing.Geometry>
                <GeometryGroup>
                  <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
                  <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
                </GeometryGroup>
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>
                <Pen Brush="Gray" Thickness="10" />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Rectangle.Fill>
    </Rectangle>
    <!-- </SnippetTileBrushTopLeftAlignmentTiledInline> -->

    <!-- <SnippetTileBrushBottomRightAlignmentTiledInline> -->
    <Rectangle 
      Width="150" Height="150"
      Stroke="Black" StrokeThickness="2"
      Margin="20">
      <Rectangle.Fill>
        
        <!-- This brush's content is aligned to the top left
             of its tile. -->
        <DrawingBrush
          Stretch="Uniform"
          Viewport="0,0,0.25,0.5"
          TileMode="Tile" 
          AlignmentX="Left"
          AlignmentY="Bottom">
          <DrawingBrush.Drawing>
            <GeometryDrawing Brush="MediumBlue">
              <GeometryDrawing.Geometry>
                <GeometryGroup>
                  <EllipseGeometry RadiusX="20" RadiusY="45" Center="50,50" />
                  <EllipseGeometry RadiusX="45" RadiusY="20" Center="50,50" />
                </GeometryGroup>
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>
                <Pen Brush="Gray" Thickness="10" />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Rectangle.Fill>
    </Rectangle>
    <!-- </SnippetTileBrushBottomRightAlignmentTiledInline> -->

  </StackPanel>
</Page>
<!-- </SnippetTileBrushAlignmentExample> -->
