<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="Microsoft.Samples.BrushExamples.ViewboxIllustration2"
  WindowTitle="Tiling Example"
  Background="White" >
  <Page.Resources>
    <Style TargetType="{x:Type TextBlock}">
      <Setter Property="FontSize" Value="8pt" />
      <Setter Property="FontFamily" Value="Verdana" />
    </Style>

    <Style TargetType="{x:Type Border}">
      <Setter Property="HorizontalAlignment" Value="Left" />
      <Setter Property="VerticalAlignment" Value="Top" />
    </Style>
  </Page.Resources>

  <StackPanel Orientation="Vertical" Margin="20">


    <Rectangle Width="100" Height="100">
      <Rectangle.Fill>
        <DrawingBrush 
          Drawing="{StaticResource TestPatternDrawing}" />
      </Rectangle.Fill>
    </Rectangle>


    <StackPanel Margin="20">

      <TextBlock>
        Viewbox: 0,0, 0.25,0.5
      </TextBlock>

      <StackPanel Orientation="Horizontal" Margin="0,10,0,20">
        <StackPanel>
          <Canvas Width="100" Height="100" VerticalAlignment="Top">
            <Rectangle Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}" />
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle
              Stroke="Red" StrokeThickness="1"
              Width="25" Height="50"
        />
          </Canvas>
          <TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
        </StackPanel>


        <Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">

        </Path>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0,0,0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="None" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0,0,0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="Fill" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0,0,0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="Uniform" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0,0,0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="UniformToFill" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
        </StackPanel>

      </StackPanel>
    </StackPanel>





    <StackPanel Margin="20">

      <TextBlock>
        Viewbox: 0.5,0.25, 0.25,0.5
      </TextBlock>

      <StackPanel Orientation="Horizontal" Margin="0,10,0,20">
        <StackPanel>
          <Canvas Width="100" Height="100" VerticalAlignment="Top">
            <Rectangle Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}" />
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle
              Canvas.Left="50" Canvas.Top="25" 
              Stroke="Red" StrokeThickness="1"
              Width="25" Height="50"
        />
          </Canvas>
          <TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
        </StackPanel>


        <Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">

        </Path>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="None" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="Fill" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="Uniform" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,1,1"
                  ViewportUnits="RelativeToBoundingBox" 
                  Stretch="UniformToFill" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
        </StackPanel>

      </StackPanel>
    </StackPanel>


    <StackPanel Margin="20">

      <TextBlock>
        Viewbox: 0.5,0.25, 0.25,0.5
      </TextBlock>

      <StackPanel Orientation="Horizontal" Margin="0,10,0,20">
        <StackPanel>
          <Canvas Width="100" Height="100" VerticalAlignment="Top">
            <Rectangle Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}" />
              </Rectangle.Fill>
            </Rectangle>
            <Rectangle
              Canvas.Left="50" Canvas.Top="25" 
              Stroke="Red" StrokeThickness="1"
              Width="25" Height="50"
        />
          </Canvas>
          <TextBlock Margin="0,2,0,0">The Viewbox</TextBlock>
        </StackPanel>


        <Path Data="M0,0 L50,50 0,100Z" Fill="Red" Margin="20,0,0,0">

        </Path>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,0.5,0.5"
                  ViewportUnits="RelativeToBoundingBox" 
                  TileMode="Tile" 
                  Stretch="None" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: None</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,0.5,0.5"
                  ViewportUnits="RelativeToBoundingBox" 
                  TileMode="Tile" 
                  Stretch="Fill" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Fill</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,0.5,0.5"
                  ViewportUnits="RelativeToBoundingBox" 
                  TileMode="Tile" 
                  Stretch="Uniform" 
                  AlignmentX="Center"
                  AlignmentY="Center"/>
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: Uniform</TextBlock>
        </StackPanel>

        <StackPanel Margin="20,0,0,0" >
          <Border 
          BorderBrush="Black" BorderThickness="1" 
         VerticalAlignment="Top">
            <Rectangle
             Width="100" Height="100">
              <Rectangle.Fill>
                <DrawingBrush 
                  Drawing="{StaticResource TestPatternDrawing}"
                  Viewbox="0.5,0.25, 0.25,0.5" 
                  ViewboxUnits="RelativeToBoundingBox" 
                  Viewport="0,0,0.5,0.5"
                  ViewportUnits="RelativeToBoundingBox" 
                  TileMode="Tile" 
                  Stretch="UniformToFill" 
                  AlignmentX="Center"
                  AlignmentY="Center" />
              </Rectangle.Fill>
            </Rectangle>
          </Border>
          <TextBlock Margin="0,2,0,0">Stretch: UniformToFill</TextBlock>
        </StackPanel>

      </StackPanel>
    </StackPanel>

  </StackPanel>
</Page>
