SolidColorBrush's color is specified using 6-digit hexadecimal notation.


   
 

<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <!-- Gives all the rectangles in this panel a white stroke. -->
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>


      <Rectangle Width="50" Height="50">
        <Rectangle.Fill>
          <SolidColorBrush Color="#0000FF" />
        </Rectangle.Fill>
      </Rectangle>

    </Canvas>
</Window>

   
     


SolidColorBrush's color is specified using 3-digit hexadecimal notation.


   
 
            

<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <!-- Gives all the rectangles in this panel a white stroke. -->
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>


      <Rectangle Width="50" Height="50">
        <Rectangle.Fill>
          <SolidColorBrush Color="#00F" />
        </Rectangle.Fill>
      </Rectangle>

    </Canvas>
</Window>

   
     


SolidColorBrush's Color property is specified using one of the predefined colors defined by the System.Windows.Media.Colors class


   
 

<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <!-- Gives all the rectangles in this panel a white stroke. -->
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>

      <Rectangle Width="50" Height="50">
        <Rectangle.Fill>
          <SolidColorBrush Color="Blue" />
        </Rectangle.Fill>
      </Rectangle>

    </Canvas>
</Window>

   
     


SolidColorBrush described using 8-digit hexadecimal notation.


   
 

<!--
The first two digits describe the opacity of the color. 
The remaining digits specify the amount of red, green, and blue in the color.
-->
            
<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>

      <Rectangle Width="50" Height="50" Fill="#FF0000FF" />

    </Canvas>
</Window>

   
     


SolidColorBrush described using 6-digit hexadecimal notation.


   
 

<!--The first pair of digits describes the amount of red in the color,
the next pair describes the amount of green,
and the final two digits describes the amount of blue.
-->
            
<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <!-- Gives all the rectangles in this panel a white stroke. -->
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>
      <Rectangle Width="50" Height="50" Fill="#0000FF" />

    </Canvas>
</Window>

   
     


SolidColorBrush described using 3-digit hexadecimal notation: amount of red, green, and blue in the color.


   
 

            
<Window x:Class="WpfApplication1.ShapesWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ShapesWindow" Height="160" Width="400">
      <Window.Resources>
        <Style TargetType="{x:Type Rectangle}">
          
          <!-- Gives all the rectangles in this panel a white stroke. -->
          <Setter Property="Stroke" Value="White"/>
          <Setter Property="StrokeThickness" Value="1"/>
        </Style>
      </Window.Resources>
    <Canvas>
      <Rectangle Width="50" Height="50" Fill="#00F" />
    </Canvas>
</Window>

   
     


SolidColorBrush objects: Brushes.Red, Brushes.MediumBlue,Brushes.Purple, and Brushes.Gold


   
 
<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>
    <Style TargetType="{x:Type Rectangle}">
      <Setter Property="Stroke" Value="Black"/>
      <Setter Property="StrokeThickness" Value="2"/>
      <Setter Property="Margin" Value="0,0,5,5"/>
      <Setter Property="VerticalAlignment" Value="Top"/>
    </Style>
    <Style TargetType="{x:Type Ellipse}">
      <Setter Property="Stroke" Value="Black"/>
      <Setter Property="StrokeThickness" Value="2"/>
      <Setter Property="Margin" Value="0,0,5,5"/>
    </Style>
  </Window.Resources>
    <StackPanel>
      <Rectangle Fill="Red" Width="150" Height="150" />
      <Rectangle Fill="MediumBlue" Width="50" Height="50" />
      <Rectangle Fill="Purple" Width="50" Height="50" />
      <Rectangle Fill="Gold" Width="50" Height="50"/>
    </StackPanel>
</Window>