C
C#2y ago
Jelles

Binding Colors to WPF Window

My model contains a field with a Color value that I am trying to bind to in my MainWindow.xaml. My issue is that when I do this nothing gets drawn... If I put the value on AQUA or something by removing the binding it works fine...
7 Replies
Jelles
JellesOP2y ago
Here you can see my Fill has Aqua and it works like this But when I add {Binding Color} it does not
Jelles
JellesOP2y ago
Jelles
JellesOP2y ago
It has to do with the color cause the other bindings work fine on the Elipse field. If anyone has a solution let me know! Thanks
Alexicon
Alexicon2y ago
WPF does not use colors but rather "Brushes" to draw. You would want a "SolidColorBrush" in this case:
Alexicon
Alexicon2y ago
Alexicon
Alexicon2y ago
you can pass your color into the solidcolorbrush's constructor
Jelles
JellesOP2y ago
Perfect thanks for the solution!
Want results from more Discord servers?
Add your server