I'm trying to get the background color of a button and convert it to a string to display in rgb, hsl, and hex formats. I've made some progress in getting the hex value out of the button background color, but I've yet to find any info on how to get the background color value converted to a string for display in rgb and hsl formats.
Here's what I have so far:
I have the 2nd and 3rd TextBlocks displaying the same hex value for now. Anyone have any ideas?
Here's what I have so far:
Code:
public void colorCodes(object sender, RoutedEventArgs e)
{
Button _b = sender as Button;
SolidColorBrush _s = _b.Background as SolidColorBrush;
var color = _s.Color;
txtblk1.Text = color.ToString();
txtblk2.Text = color.ToString();
txtblk3.Text = color.ToString();
}
I have the 2nd and 3rd TextBlocks displaying the same hex value for now. Anyone have any ideas?