Reference SystemColors


   
     
<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Orientation="Horizontal">
    <StackPanel>
        <StackPanel.Resources>
            <SolidColorBrush 
                x:Key="{x:Static SystemColors.ActiveCaptionBrushKey}" 
                Color="Red" />
        </StackPanel.Resources>

        <Button HorizontalAlignment="Center" VerticalAlignment="Center" 
                Margin="24" Foreground="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}">
            Button with Red text
        </Button>
    </StackPanel>

    <StackPanel>
        <Button HorizontalAlignment="Center" 
                VerticalAlignment="Center" 
                Margin="24"
                Foreground="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}">
            Button with Blue text
        </Button>
    </StackPanel>

</StackPanel>

   
    
    
    
    
     


Line Joins Miter


   
     

<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>
  <Polyline
    Points="50,50 75,30 100,100 130,40"
    Stroke="Red"
    StrokeThickness="20"
    StrokeLineJoin="Miter"
    Grid.Row="1" Grid.Column="1"/>

  </Canvas>
</Page>

   
    
    
    
    
     


StackPanel.Orientation=Vertical


   
     

<Page x:Class="WebPageNavigation.Page1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  WindowTitle="Page1"
  >
  <Grid>
    <StackPanel Grid.Column="2" Grid.Row="0" HorizontalAlignment="Left" Name="StackPanel3" 
                VerticalAlignment="Top">
        <TextBlock FontSize="18" HorizontalAlignment="Center" Margin="0,0,0,15">StackPanel3</TextBlock>

        <Button Margin="10">Button 7</Button>
        <Button Margin="10">Button 8</Button>
        <Button Margin="10">Button 9</Button>

        <TextBlock>ColumnDefinition.Width="Auto"</TextBlock>
        <TextBlock>StackPanel.HorizontalAlignment="Left"</TextBlock>
        <TextBlock>StackPanel.VerticalAlignment="Top"</TextBlock>
        <TextBlock>StackPanel.Orientation="Vertical"</TextBlock>
        <TextBlock>Button.Margin="10"</TextBlock>      
    </StackPanel>
  </Grid>
</Page>

   
    
    
    
    
     


Desktop to AppWorkspace


   
     
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="Examples" >

   <Canvas> 
        <Button Width="120" Height="20">
          <Button.Background>
            <RadialGradientBrush>
              <RadialGradientBrush.GradientStops>
                  <GradientStop Offset="0" Color="{x:Static SystemColors.DesktopColor}"/>
                  <GradientStop Offset="1" Color="{x:Static SystemColors.AppWorkspaceColor}"/>
              </RadialGradientBrush.GradientStops>
            </RadialGradientBrush>
          </Button.Background>
        </Button>   

   </Canvas> 


</Window>

   
    
    
    
    
     


The Opacity Mask Use the opacity mask brush as a fill to show what it looks like


   
     
<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SDKSample.SampleViewer"
    Title="Examples" >

   <Canvas> 
      <Rectangle Height="150" Width="200" Stroke="Black" StrokeThickness="1"
        HorizontalAlignment="Left" Margin="10">
        <Rectangle.Fill>
          <ImageBrush Viewport="0,0,50,50"
            ViewportUnits="Absolute"
            TileMode="Tile"  
            ImageSource="c:image.png"/>
        </Rectangle.Fill>
      </Rectangle>

   </Canvas> 


</Window>

   
    
    
    
    
     


Style resource with predefined static resource


   
     


<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:System;assembly=mscorlib">
    <Canvas.Resources>
        <FontFamily x:Key="fntfam">Times New Roman</FontFamily>
        <s:Double x:Key="fntsize">96</s:Double>

        <TransformGroup x:Key="xform">
            <ScaleTransform ScaleX="{Binding Source={StaticResource fntfam}, Path=Baseline}" />
            <ScaleTransform ScaleX="{StaticResource fntsize}" />
        </TransformGroup>

        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="{StaticResource fntfam}" />
            <Setter Property="FontSize" Value="{StaticResource fntsize}" />
            <Setter Property="Text" Value="Reflect" />
            <Setter Property="Canvas.Left" Value="400" />
            <Setter Property="Canvas.Top" Value="48" />
        </Style>
    </Canvas.Resources>

    <TextBlock>asdf</TextBlock>


</Canvas>

   
    
    
    
    
     


Applies a RotateTransform to the DrawingBrush's RelativeTransform property


   
     
<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">
    <Window.Resources>
    <DrawingGroup x:Key="myDrawing" >
      <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" />
    </DrawingGroup>
    </Window.Resources>
    <Rectangle Width="175" Height="90" Stroke="Black">
      <Rectangle.Fill>
        <DrawingBrush Drawing="{StaticResource myDrawing}">
          <DrawingBrush.RelativeTransform>
            <RotateTransform CenterX="0.5" CenterY="0.5" Angle="45" />
          </DrawingBrush.RelativeTransform>
        </DrawingBrush>
      </Rectangle.Fill>
    </Rectangle>

</Window>