I use this code to change my background t1.Background = Brushes.White;
and it's working but how do I do it with hex codes? Because t1.Background = Brushes.#FF2463AE;
doesn't work. I'm using Visual Studio 2015. Thank You.
Use BrushConverter
t1.Background = (Brush)(new BrushConverter().ConvertFrom("#FF2463AE"));
It would probably be best to create a single instance of the converter if you are doing many conversions.
You could try it like this:
SolidColorBrush color = (SolidColorBrush)(new BrushConverter().ConvertFrom("#ffaacc"));
t1.Background = color;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With