Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to set a label to a default color globally?

$
0
0
Moving from C# -> Windows Forms to WPF

Windows Forms: In the past I've set as a descriptor:

Color gcolorBackDialogBox;
Color gcolorForeDialogBox;

Under dlg_Load() I've defined them as:

gcolorBackDialogBox = this.BackColor;
gcolorForeDialogBox = this.ForeColor;

Under a function I've used them as:

gLBlStatus.BackColor = gcolorBackDialogBox;
gLBlStatus.ForeColor = gcolorForeDialogBox;

where gLBlStatus is the name of a label on a dialog box. This sets the label to the same color as the dialog box.

WPF: I'm converting to C# -> WPF.  I can change the labels:

gLBlStatus.Background = Brushes.LightGray;
gLBlStatus.Foreground = Brushes.Black;

but can't find a way to replicate the global aspect.

I've found that the default dialog box color is SystemColors.ControlBrushKey ... am unable to find a way to make this nomenclature work.

cte677


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>