Objects that use a brush color


Setting A Brush Color

	MyTextBlock.Foreground = new SolidColorBrush(Colors.White);    //<<<Note its Colors, not Color!

	MyTextBlock.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));

Using a const defined color

This is actually quite hard as Color can’t be defined const and .FromArgb can’t take a Int32 in UWP. The following achieves it

	public static readonly byte[] MyConstColor = new byte[] { 0xff, 0xff, 0xff, 0xff };

	MyTextBlock.Foreground = new SolidColorBrush(Color.FromArgb(MyConstColor[0], MyConstColor[1], MyConstColor[2], MyConstColor[3]));
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.