Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The best method I've found is experimentation and guessing.</p> <p>I created a little utility to visualize these colors.</p> <h2>Interface</h2> <p><img src="https://i.stack.imgur.com/ltNL5.jpg" alt="System.Windows.SystemColors"></p> <h2>XAML</h2> <pre><code>&lt;Window x:Class="SystemColors1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="System.Windows.SystemColors" Height="350" Width="525"&gt; &lt;Window.Resources&gt; &lt;DataTemplate x:Key="CellColor"&gt; &lt;DockPanel&gt; &lt;TextBlock&gt; &lt;TextBlock.Background&gt; &lt;SolidColorBrush Color="{Binding Path=Color}" /&gt; &lt;/TextBlock.Background&gt; &lt;TextBlock.Text&gt; &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/TextBlock.Text&gt; &lt;/TextBlock&gt; &lt;/DockPanel&gt; &lt;/DataTemplate&gt; &lt;/Window.Resources&gt; &lt;Grid&gt; &lt;ListView Grid.Row="1" Name="SystemColorsList" ItemsSource="{Binding}"&gt; &lt;ListView.View&gt; &lt;GridView AllowsColumnReorder="True"&gt; &lt;GridViewColumn CellTemplate="{StaticResource CellColor}" Header="Color" Width="Auto"/&gt; &lt;GridViewColumn DisplayMemberBinding="{Binding Path=Name}" Header="Name" Width="Auto"/&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre> <h2>C#</h2> <pre><code>using System.Collections.Generic; using System.Windows; using System.Windows.Media; using System.Reflection; namespace SystemColors1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); List&lt;ColorAndName&gt; l = new List&lt;ColorAndName&gt;(); foreach (PropertyInfo i in typeof(System.Windows.SystemColors).GetProperties()) { if (i.PropertyType == typeof(Color)) { ColorAndName cn = new ColorAndName(); cn.Color = (Color)i.GetValue(new Color(), BindingFlags.GetProperty, null, null, null); cn.Name = i.Name; l.Add(cn); } } SystemColorsList.DataContext = l; } } class ColorAndName { public Color Color { get; set; } public string Name { get; set; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload