The app's resource dictionary doesn't know about other dictionaries and unlike with WPF's DynamicResources
- StaticResource
isn't reevaluated and ThemeResource
is, but I think only when the actual theme changes. The way you can customize the color of that button is to use TemplateBinding
in the template and bind to say the Foreground
property of the button and also set that in the Foreground
Setter
of your button style to {StaticResource SectionDefaultBrush}
. Then in your page you can override that by setting the Foreground
of the button to a different value or using a derived button style that changes the Foreground
value.
Ideally too - you should define theme resources in your dictionary so the brushes change depending on OS theme (especially high contrast). You might want to name your brush then as "SectionDefaultThemeBrush" instead of just "SectionDefaultBrush".