I'm trying to create a SolidColorBrush
with Windows 11 theme color.
I'm able to use Windows 11's theme color directly, but cannot create a SolidColorBrush
.
<!-- This works: -->
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground"
Value="{x:Static SystemParameters.WindowGlassBrush}"/>
</Style>
<!-- This does not work: -->
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightColor}" Color="Red"/>
Any ideas?
CodePudding user response:
If you want to create a SolidColorBrush
based on Windows theme color you could do it for example such way:
<SolidColorBrush x:Key="scbr"
Color="{Binding Color, Source={x:Static SystemParameters.WindowGlassBrush}}"
Opacity="{Binding Opacity, Source={x:Static SystemParameters.WindowGlassBrush}}"
Transform="{Binding Transform, Source={x:Static SystemParameters.WindowGlassBrush}}" />