0

Where can I get symbolic names for WPF "system" colors? I tried SystemColors but the names do not tell me much, for example I don't see an entry for disabled label text color.

And I am looking for something along such lines -- enabled button text color, enabled button background color, disabled button text color, and so on.

astrowalker
  • 3,123
  • 3
  • 21
  • 40
  • Could you maybe tell us why you need them? System controls share the `SystemColors.Control*` brushes so you will not find any specific SystemColors for button, textblock, etc. If you make your own control, just use those. – Freggar Jun 28 '18 at 07:11
  • @Freggar, because I set `red`, then `green` and then I need my label looks like disabled one. If I set `gray` it would maybe work for default theme, but if the theme is different `gray` would not be valid as disabled color. So I need something like `my_label.Foreground = SystemColors.Disabled....` but I cannot find anything relevant. I see those `ControlXXX` entries but again nothing related to disabled colors. – astrowalker Jun 28 '18 at 07:26
  • You probably want to use `SystemColors.ControlDark`. https://stackoverflow.com/questions/7766584/what-is-the-system-color-of-disabled-text – Freggar Jun 28 '18 at 08:09
  • Btw you can do some neat trick in the GUI designer. Right click on the label (in Design view) "Edit Style" -> "Edit a copy". This will show you the different brushes that the label uses. You will find that the label actually uses `SystemColors.GrayTextBrushKey` for disabled text... – Freggar Jun 28 '18 at 08:17

1 Answers1

0

You can access system colors with x:Static:

<TextBox Text="Looks like disabled text" Foreground="{x:Static SystemColors.GrayTextBrush}"/>

It makes sens also always to take a look to the default styles and templates Control Styles and Templates since a lot of colors are defined there.

Here are available SystemColors.

Rekshino
  • 6,954
  • 2
  • 19
  • 44