Colors Class

July 28, 2014

Implements a set of predefined colors.

System.Object
  System.Windows.Media.Colors

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

public sealed class Colors

The Colors type exposes the following members.

  NameDescription
Public propertyStatic memberBlackGets the system-defined color that has the ARGB value of #FF000000.
Public propertyStatic memberBlueGets the system-defined color that has the ARGB value of #FF0000FF.
Public propertyStatic memberBrownGets the system-defined color that has the ARGB value of #FFA52A2A.
Public propertyStatic memberCyanGets the system-defined color that has the ARGB value of #FF00FFFF.
Public propertyStatic memberDarkGrayGets the system-defined color that has the ARGB value of #FFA9A9A9.
Public propertyStatic memberGrayGets the system-defined color that has the ARGB value of #FF808080.
Public propertyStatic memberGreenGets the system-defined color that has the ARGB value of #FF008000.
Public propertyStatic memberLightGrayGets the system-defined color that has the ARGB value of #FFD3D3D3.
Public propertyStatic memberMagentaGets the system-defined color that has the ARGB value of #FFFF00FF.
Public propertyStatic memberOrangeGets the system-defined color that has the ARGB value of #FFFFA500.
Public propertyStatic memberPurpleGets the system-defined color that has the ARGB value of #FF800080.
Public propertyStatic memberRedGets the system-defined color that has the ARGB value of #FFFF0000.
Public propertyStatic memberTransparentGets the system-defined color that has the ARGB value of #00FFFFFF.
Public propertyStatic memberWhiteGets the system-defined color that has the ARGB value of #FFFFFFFF.
Public propertyStatic memberYellowGets the system-defined color that has the ARGB value of #FFFFFF00.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

XAML Usage for Colors

You cannot instantiate objects from this managed class in XAML, but you can use its static properties to provide property values in XAML. There are additional named colors that can be specified in XAML, but these are not backed by static property values of Colors. For information about other color usages in XAML, including named colors and ARGB or scARGB syntax, see Color.

The XAML object element usage (with initialization text) is useful for declaring a Color as a resource dictionary.

NoteNote:

Windows Phone uses a resource dictionary for theme resources, which includes colors. These color resources are the recommended way to apply color in Windows Phone applications because they ensure UI elements appear consistency and can change color based on the theme the user has selected. For a more consistent user experience, avoid using static colors. For more information, see Theme resources for Windows Phone.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Show:
© 2014 Microsoft