Reputation: 8408
I'm trying to use a hex colour (#E32017
) programmatically for text within a textblock but it's not working. Does anyone know how a hex colour can used instead of Colors.Red
when it comes to textblocks for Windows Phone?
TextBlock textBlock = new TextBlock();
textBlock.Inlines.Add(new Run { Text = "H", Foreground = new SolidColorBrush(Colors.Red) });
Upvotes: 0
Views: 155
Reputation: 55499
You can call the Color.FromArgb method and specify the individual red, green, and blue components of your color:
Foreground = new SolidColorBrush(Color.FromArgb(0xFF, 0xE3, 0x20, 0x17))
Upvotes: 2