<Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="Microsoft.Samples.BrushExamples.ViewboxIllustration"
  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">



    <Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,20"
      VerticalAlignment="Top" HorizontalAlignment="Left">
    <Rectangle
     Width="100" Height="100">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource TestPatternDrawing}"  />
      </Rectangle.Fill>
    </Rectangle>
    </Border>

<StackPanel Orientation="Vertical">  
  
  
  <Border BorderThickness="0" BorderBrush="Red"
    Padding="0" Margin="0,20,0,0" >
  <StackPanel >
    <Border  
      BorderBrush="Red" 
      BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
      <!--
      <Border.Background>
        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5" >
          <GradientStop Offset="0" Color="WhiteSmoke" />
          <GradientStop Offset="1" Color="Transparent" />
        </LinearGradientBrush>
      </Border.Background>
      -->
      
    <Grid Margin="2">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />        
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>      
      <TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
      <TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>   
      <TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock> 
      <TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,1,1</TextBlock>    
      
      
      <TextBlock Grid.Column="2" Grid.Row="0"
        Margin="10,0,0,0">ViewboxUnits:</TextBlock>
      <TextBlock Grid.Column="3" Grid.Row="0"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
        
      <TextBlock Grid.Column="2" Grid.Row="1"
        Margin="10,0,0,0">ViewportUnits:</TextBlock>    
      <TextBlock Grid.Column="3" Grid.Row="1"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>          
        
    </Grid>
      <!--
      <Border.BitmapEffect>
        <DropShadowBitmapEffect />
      </Border.BitmapEffect>
      -->
    </Border>
  
    <StackPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">

    <StackPanel Margin="0,0,10,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"         
          Stretch="None"  
             />
      </Rectangle.Fill>
    </Rectangle>
    </Border>
    <TextBlock>Stretch: None</TextBlock>
    </StackPanel>

    <StackPanel Margin="0,0,10,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" Stretch="Fill"   />
      </Rectangle.Fill>
    </Rectangle>
    </Border>
    <TextBlock>Stretch: Fill</TextBlock>
    </StackPanel>

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

    </StackPanel>    

  </Border>


  <Border BorderThickness="0" BorderBrush="Red"
    Padding="0" Margin="0,20,0,0" >
  <StackPanel >
    <Border  
      BorderBrush="Red" 
      BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
    <Grid Margin="2">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />        
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>      
      <TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
      <TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>   
      <TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock> 
      <TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>    
      
      
      <TextBlock Grid.Column="2" Grid.Row="0"
        Margin="10,0,0,0">ViewboxUnits:</TextBlock>
      <TextBlock Grid.Column="3" Grid.Row="0"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
        
      <TextBlock Grid.Column="2" Grid.Row="1"
        Margin="10,0,0,0">ViewportUnits:</TextBlock>    
      <TextBlock Grid.Column="3" Grid.Row="1"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>          
        
    </Grid>
      

      
    </Border>
  
    <StackPanel Orientation="Horizontal" Margin="0,5, 0, 0" HorizontalAlignment="Left">

    <StackPanel Margin="0,0,10,0">
         <TextBlock>Stretch: None</TextBlock>
       <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" 
             Viewport="0,0,0.5,0.5"
             Stretch="None" />
         </Rectangle.Fill>
       </Rectangle>
       </Border>
       </StackPanel>
   
       <StackPanel Margin="0,0,10,0">   
         <TextBlock>Stretch: Fill</TextBlock>
         
       <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" 
             Viewport="0,0,0.5,0.5"
             Stretch="Fill" />
         </Rectangle.Fill>
       </Rectangle>
       </Border>
       </StackPanel>
   
       <StackPanel Margin="0,0,10,0">    
         <TextBlock>Stretch: Uniform</TextBlock>
       <Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
         VerticalAlignment="Top">
       <Rectangle
        Width="100" Height="100">
         <Rectangle.Fill>
           <DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
             Viewbox="0,0,0.25,0.5" 
             Viewport="0,0,0.5,0.5"
             Stretch="Uniform" />
         </Rectangle.Fill>
       </Rectangle>
       </Border>
       </StackPanel>
       </StackPanel>    
   
  

    </StackPanel> 


   

</Border>

 </StackPanel>
 
 
 


<StackPanel Margin="0">

  <Border BorderThickness="0" BorderBrush="Red"
    Padding="0" Margin="0, 20,0, 0" >
  <StackPanel >
    <Border  
      BorderBrush="Red" 
      BorderThickness="0,0,0,2" HorizontalAlignment="Stretch">
    <Grid Margin="2">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="Auto" />        
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>      
      <TextBlock Grid.Column="0" Grid.Row="0">Viewbox:</TextBlock>
      <TextBlock Grid.Column="1" Grid.Row="0" Margin="10,0,0,0">0,0,0.25,0.5</TextBlock>   
      <TextBlock Grid.Column="0" Grid.Row="1">Viewport:</TextBlock> 
      <TextBlock Grid.Column="1" Grid.Row="1" Margin="10,0,0,0">0,0,0.5,0.5</TextBlock>  
      <TextBlock Grid.Column="0" Grid.Row="2">TileMode:</TextBlock>
      <TextBlock Grid.Column="1" Grid.Row="2" Margin="10,0,0,0">Tile</TextBlock>
      
      
      <TextBlock Grid.Column="2" Grid.Row="0"
        Margin="10,0,0,0">ViewboxUnits:</TextBlock>
      <TextBlock Grid.Column="3" Grid.Row="0"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>
        
      <TextBlock Grid.Column="2" Grid.Row="1"
        Margin="10,0,0,0">ViewportUnits:</TextBlock>    
      <TextBlock Grid.Column="3" Grid.Row="1"
        Margin="10,0,0,0">RelativeToBoundingBox</TextBlock>          
        
    </Grid>
      

      
    </Border>
  
  <StackPanel Orientation="Horizontal" Margin="0,5,0,0" HorizontalAlignment="Left">
    
        <StackPanel Margin="0,0,10,0">
          <TextBlock>Stretch: None</TextBlock>
        <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" 
              Viewport="0,0,0.5,0.5"
              Stretch="None"
              TileMode="Tile" />
          </Rectangle.Fill>
        </Rectangle>
        </Border>
        </StackPanel>
    
        <StackPanel Margin="0,0,10,0">      
          <TextBlock>Stretch: Fill</TextBlock>
          
        <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" 
              Viewport="0,0,0.5,0.5"
              Stretch="Fill"
              TileMode="Tile" />
          </Rectangle.Fill>
        </Rectangle>
        </Border>
        </StackPanel>
    
        <StackPanel Margin="0,0,10,0">
          <TextBlock>Stretch: Uniform</TextBlock>
        <Border BorderBrush="Black" BorderThickness="1" Margin="0,0,10,0"
          VerticalAlignment="Top">
        <Rectangle
         Width="100" Height="100">
          <Rectangle.Fill>
            <DrawingBrush Drawing="{StaticResource TestPatternDrawing}"
              Viewbox="0,0,0.25,0.5" 
              Viewport="0,0,0.5,0.5"
              Stretch="Uniform" 
              TileMode="Tile" />
          </Rectangle.Fill>
        </Rectangle>
        </Border>
     </StackPanel>
    </StackPanel>
   
  


    </StackPanel> 

</Border>




</StackPanel>









   
    
    
    
 
    
  </StackPanel>
</Page>
