This documentation is archived and is not being maintained.
Color Structure
Visual Studio 2008
Describes a color in terms of alpha, red, green, and blue channels.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
'Declaration <TypeConverterAttribute(GetType(ColorConverter))> _ <LocalizabilityAttribute(LocalizationCategory.None, Readability := Readability.Unreadable)> _ Public Structure Color _ Implements IFormattable, IEquatable(Of Color) 'Usage Dim instance As Color
<Color .../>
<object property="predefinedColor"/> - or - <object property="#rgb"/> - or - <object property="#argb"/> - or - <object property="#rrggbb"/> - or - <object property="#aarrggbb"/> - or - <object property="sc# scA,scR,scG,scB"/> - or - <object property="ContextColor profileUri alphaValue,colorValue"/>
XAML Values
This example shows how to use sRGB, ScRGB, and color profile values to create the color blue.
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <StackPanel Margin="20"> <!-- This rectangle fill uses a Color with ScRGB values to create a completely opaque blue. --> <Rectangle Width="50" Height="50" Margin="10"> <Rectangle.Fill> <SolidColorBrush> <SolidColorBrush.Color> <!-- Describes the brush's color using ScRGB values. Each value has a range of 0-1. --> <Color ScA="1.0" ScR="0.0" ScG="0.0" ScB="1.0" /> </SolidColorBrush.Color> </SolidColorBrush> </Rectangle.Fill> </Rectangle> <!-- This rectangle fill uses a Color with sRGB values to create a completely opaque blue. --> <Rectangle Width="50" Height="50" Margin="10"> <Rectangle.Fill> <SolidColorBrush> <SolidColorBrush.Color> <!-- Describes the brush's color using sRGB values. Each value is a byte with range of 0-255. --> <Color A="255" R="0" G="0" B="255" /> </SolidColorBrush.Color> </SolidColorBrush> </Rectangle.Fill> </Rectangle> <!-- This rectangle fill uses the sRGB color profile and values to create a complete opaque blue. --> <Rectangle Width="50" Height="50" Margin="10"> <Rectangle.Fill> <SolidColorBrush Color="ContextColor file://C:/WINDOWS/system32/spool/drivers/color/sRGB%20Color%20Space%20Profile.icm 1.0,0.0,0.0,1.0"/> </Rectangle.Fill> </Rectangle> </StackPanel> </Page>
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: