How to use the correct colors of a Windows system?

I want to use XAML to style the WPF button to look like the text “Mixer” and “Change date and time ...” of these pop-up windows in the Windows 7 notification area.

Does the SystemColors property define this color? What?

<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.????}}" /> 

Windows 7 Notification area flyout

+15
windows styles wpf xaml
Feb 23 '11 at 17:23
source share
4 answers

The best method I have found is experiment and guessing.

I created a small utility to visualize these colors.

Interface

System.Windows.SystemColors

Xaml

 <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"> <Window.Resources> <DataTemplate x:Key="CellColor"> <DockPanel> <TextBlock> <TextBlock.Background> <SolidColorBrush Color="{Binding Path=Color}" /> </TextBlock.Background> <TextBlock.Text> &#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160; </TextBlock.Text> </TextBlock> </DockPanel> </DataTemplate> </Window.Resources> <Grid> <ListView Grid.Row="1" Name="SystemColorsList" ItemsSource="{Binding}"> <ListView.View> <GridView AllowsColumnReorder="True"> <GridViewColumn CellTemplate="{StaticResource CellColor}" Header="Color" Width="Auto"/> <GridViewColumn DisplayMemberBinding="{Binding Path=Name}" Header="Name" Width="Auto"/> </GridView> </ListView.View> </ListView> </Grid> </Window> 

FROM#

 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<ColorAndName> l = new List<ColorAndName>(); 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; } } } 
+22
Feb 24 '11 at 19:35
source share

Check this SystemColors link and, in particular, the colors of the Aero theme .

It's not obvious what color name this text will use, but trying to notice it, it looks like HighlightBrush or MenuHighlightBrush might be candidates ...

+5
Feb 23 '11 at 18:17
source share

You might want to read Aero Theme aesthetics .

+2
Feb 23 '11 at 18:22
source share

It is very difficult to compare colors by eye!

If you take a screenshot (Prt Scr button on your keyboard), you can paste it into mspaint and use an eye dropper to get the actual color values.

The trick in the text is with an alias, but I read the text color in the screenshot as R, G, B = 0,102,204, and HotTrackColor - R, G, B = 0,102,203

As I said, the difference may be due to overlay on the text.

Note: After clicking with the Eye Dropper tool, you may need to “Change Colors” to see the actual color values. In any case, you are doing win7.

+1
Mar 21 2018-12-12T00:
source share



All Articles