Reputation: 1210
There is plenty of documentation on how to set the Foreground property of a TextBlock element out there. I cannot, however, find any way to get the hex code as a string (e.g. "#FF000000" for black) from a TextBlock's Foreground property.
I'm working with Windows Phone 8/Silverlight.
Upvotes: 1
Views: 429
Reputation: 128096
Provided that the Foreground
property is set to a SolidColorBrush, you could just call
var colorString = ((SolidColorBrush)textBlock.Foreground).Color.ToString();
Upvotes: 4