<!-- BrushOpacityExample.xaml 
     Demonstrates the Brush.Opacity property.  -->
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
   xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" 
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
   mc:Ignorable="PresentationOptions"
   Title="Brush Opacity">
  <Page.Resources>

    <!-- Because this GradientStopCollection and DrawingGroup 
         are used multiple times in this example, 
         they are defined here as resources and frozen to 
         improve performance. -->
    <GradientStopCollection x:Key="myGradientStops"
      PresentationOptions:Freeze="True">
      <GradientStop Color="Blue" Offset="0.0" />
      <GradientStop Color="Black" Offset="0.5" />
      <GradientStop Color="Transparent" Offset="1.0" />
    </GradientStopCollection>
    <DrawingGroup x:Key="myDrawing" PresentationOptions:Freeze="True">
      <DrawingGroup.Children>
        <GeometryDrawing>
          <GeometryDrawing.Geometry>
            <GeometryGroup>
              <LineGeometry StartPoint="0,0" EndPoint="1,1" />
              <LineGeometry StartPoint="0,1" EndPoint="1,0" />
            </GeometryGroup>
          </GeometryDrawing.Geometry>
          <GeometryDrawing.Pen>
            <Pen Thickness="0.2" Brush="#3366FF" />
          </GeometryDrawing.Pen>
        </GeometryDrawing>
        <GeometryDrawing Brush="Red"
         Geometry="M 0.4,0.4 L 0.5,0.2 0.6,0.4 0.5,0.5" />
        <GeometryDrawing Brush="Blue"
         Geometry="M 0.4,0.6 L 0.5,0.8 0.6,0.6 0.5,0.5" />
        <GeometryDrawing Brush="Black"
         Geometry="M 0.4,0.4 L 0.2,0.5 0.4,0.6 0.5,0.5" />
        <GeometryDrawing Brush="Green"
         Geometry="M 0.6,0.4 L 0.8,0.5 0.6,0.6 0.5,0.5" />
      </DrawingGroup.Children>
    </DrawingGroup>
  </Page.Resources>
  <Grid Margin="10">

    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="10" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="10" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="10" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="10" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="10" />
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="10" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="20" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>


    <!-- Header -->
    <Border Background="{StaticResource blueHorizontalGradientBrush}" 
      Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="12">
      <TextBlock Style="{StaticResource MyIntroTextBlockStyle}">
        This example shows how the Opacity property can be used to create brushes that are semi-transparent.
        In the following examples, several different brushes are given
        Opacity settings that range from 1.0 to 0.0.
      </TextBlock>
    </Border>

    <!-- Labels for the different examples -->
    <Rectangle Grid.Row="4" Grid.Column="2" Grid.RowSpan="9" Grid.ColumnSpan="9" Fill="{StaticResource checkeredBackground}" />
    <TextBlock Grid.Row="2" Grid.Column="2">
      Opacity: 1.0
    </TextBlock>
    <TextBlock Grid.Row="2" Grid.Column="4">
      Opacity: 0.75
    </TextBlock>
    <TextBlock Grid.Row="2" Grid.Column="6">
      Opacity: 0.5
    </TextBlock>
    <TextBlock Grid.Row="2" Grid.Column="8">
      Opacity: 0.25
    </TextBlock>
    <TextBlock Grid.Row="2" Grid.Column="10">
      Opacity: 0.0
    </TextBlock>
    <TextBlock Grid.Row="4" Grid.Column="0">
      SolidColorBrush
    </TextBlock>
    <TextBlock Grid.Row="6" Grid.Column="0">
      LinearGradientBrush
    </TextBlock>
    <TextBlock Grid.Row="8" Grid.Column="0">
      RadialGradientBrush
    </TextBlock>
    <TextBlock Grid.Row="10" Grid.Column="0">
      ImageBrush
    </TextBlock>
    <TextBlock Grid.Row="12" Grid.Column="0">
      DrawingBrush
    </TextBlock>

    <!-- SolidColorBrush examples -->
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="2">
      <Rectangle.Fill>
        <SolidColorBrush Color="Blue" Opacity="1" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="4">
      <Rectangle.Fill>
        <SolidColorBrush Color="Blue" Opacity="0.75" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="6">
      <Rectangle.Fill>
        <SolidColorBrush Color="Blue" Opacity="0.5" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="8">
      <Rectangle.Fill>
        <SolidColorBrush Color="Blue" Opacity="0.25" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="4" Grid.Column="10">
      <Rectangle.Fill>
        <SolidColorBrush Color="Blue" Opacity="0" />
      </Rectangle.Fill>
    </Rectangle>

    <!-- LinearGradientBrush examples -->
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="2">
      <Rectangle.Fill>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="1" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="4">
      <Rectangle.Fill>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.75" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="6">
      <Rectangle.Fill>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.5" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="8">
      <Rectangle.Fill>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.25" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="6" Grid.Column="10">
      <Rectangle.Fill>
        <LinearGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0" />
      </Rectangle.Fill>
    </Rectangle>

    <!-- RadialGradientBrush examples -->
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="2">
      <Rectangle.Fill>
        <RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="1.0" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="4">
      <Rectangle.Fill>
        <RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.75" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="6">
      <Rectangle.Fill>
        <RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.5" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="8">
      <Rectangle.Fill>
        <RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0.25" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="8" Grid.Column="10">
      <Rectangle.Fill>
        <RadialGradientBrush GradientStops="{StaticResource myGradientStops}" Opacity="0" />
      </Rectangle.Fill>
    </Rectangle>

    <!-- ImageBrush examples -->
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="2">
      <Rectangle.Fill>
        <ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="1.0" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="4">
      <Rectangle.Fill>
        <ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.75" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="6">
      <Rectangle.Fill>
        <ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.5" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="8">
      <Rectangle.Fill>
        <ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0.25" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="10" Grid.Column="10">
      <Rectangle.Fill>
        <ImageBrush ImageSource="sampleImages\pinkcherries.jpg" Opacity="0" />
      </Rectangle.Fill>
    </Rectangle>

    <!-- DrawingBrush examples -->
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="2">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="1.0" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="4">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.75" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="6">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.5" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="8">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0.25" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Width="100" Height="50" Stroke="Black" StrokeThickness="1" Grid.Row="12" Grid.Column="10">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}" Opacity="0" />
      </Rectangle.Fill>
    </Rectangle>
    <Rectangle Style="{StaticResource footerRectangleStyle}" Grid.Row="14" Grid.Column="0" Grid.ColumnSpan="12" Fill="{StaticResource blueHorizontalGradientBrush}" />
  
  
  </Grid>
</Page>
