#224 – Using Predefined System Colors in XAML

The System.Windows.SystemColors class contains a series of static properties that expose the current predefined system colors.  (Click here to see a list of these system colors).

You can use the x:Static markup extension in XAML to reference one of the predefined static properties in the SystemColors class.  Here we use a property that represents a predefined SolidColorBrush.

	<StackPanel>
		<Ellipse Height="100" Width="200" Fill="{x:Static SystemColors.HighlightBrush}" Margin="30"/>
	</StackPanel>

Advertisements