Well i have a application that is black and white and i need a function to lower the brightness how can i do this? all the white comes from a SolidColorBrush that is saved in a ResourceDictionary(Application.xaml), my current solution is to put a empty window that is back with 80% opacity over it but this does not allow me to use the underlying window..
Share
If all your UI elements are using the same
Brush, why not just modify theBrushto reduce the brightness? For example:Edit after your comment on the
Brushbeing frozen:If you’re using one of the built-in brushes (via the
Brushesclass) then it will be frozen. Instead of using one of them, declare your ownBrushwithout freezing it:Edit after Robert’s comment on Application-level resources:
Robert is right. Resources added at the
Applicationlevel are automatically frozen if they are freezable. Even if you explicitly ask for them not to be frozen:There are two ways around this that I can see:
Window‘sResourcescollection. This makes it harder to share though.As an example of #2 consider the following.
App.xaml:
Window1.xaml:
Window1.xaml.cs:
It’s not as pretty, but it’s the best I can come up with right now.