I have a Styles.xaml file where I declared different colors and styles.
<SolidColorBrush x:Key="MyColour" Color="#FFFF411E"/>
I want to access this in code, since I have control, and I want to bind the background color to the object in the object. This is easy to do, however, an object is created from a response to a server call, and the property can be one of many colors. I could define a color in the code, but since I use the same color for the other controls defined in XAML, I don’t want the same color to point twice in the application. Therefore, I want to be able to access the brush SolidColorBrushin the code in order to use it.
Any idea how to do this?
source
share