Uses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes class : Brush « Windows Presentation Foundation « C# / C Sharp






Uses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes class

Uses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes 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" Fill="Blue" />
    </Canvas>
</Window>

   
    
    
    
    
    
  








Related examples in the same category

1.Set color for SolidColorBrushSet color for SolidColorBrush
2.Paint with system brushes and colors.Paint with system brushes and colors.
3.Gradient brushes within a DrawingBrush. Two overlapping gradients are layeredGradient brushes within a DrawingBrush. Two overlapping gradients are layered
4.OpacityMask, LinearGradientBrush, RenderTransform
5.Brush resourceBrush resource
6.Use a VisualBrush to magnify a portion of the screen.Use a VisualBrush to magnify a portion of the screen.
7.Predefined brush in Brushes ClassPredefined brush in Brushes Class
8.Solid Color Brush In Code with predefined brushSolid Color Brush In Code with predefined brush
9.Solid Color Brush In Code with SolidColorBrushSolid Color Brush In Code with SolidColorBrush
10.Solid Color Brush In Code with SolidColorBrush and RGB colorSolid Color Brush In Code with SolidColorBrush and RGB color