Can I change/"rebind" the default WinRT system brushes/palette colors to match my app?

and would it be best practice to do it this way?

So for instance, HyperlinkPointerOverBrush defines a dark blue/green and this is the default brush colour my app inherits for when your mouse/"finger" is hovered over a link. But can the colour assignment from dark blue/green easily be changed to something else?

(Below illustrates the list of system brushes my app has reference to)

I tried setting HyperlinkPointerOverBrush to something different in my App.xaml:

<SolidColorBrush x:Key="HyperlinkPointerOverBrush" Color="#FF0A2562"/>

within my metro app, but to no avail; my links still stayed the default dark blue/green.

Any thoughts on how I would approach this? and also best practices on defining your app's System Brushes aka. "Palette" you wish to use on Windows 8 Metro-style WinRT apps? (that's a mouthful)

Thanks.

Answers


The controls that come out of the box in winrt assemblies have styles and templates that use resources from these assemblies. The one simple thing you can do to change it is to set RequestedTheme="Light" in app.xaml. To change arbitrary brushes you would also need to modify the styles/templates themselves by overriding them explicitly when you use the controls.

You can extract the default templates in the design view context menu by going to "Edit Template"/"Edit a Copy...". You would then modify the extracted styles using your theme resources.

You can use a predefined set of resources or a theme by merging it in your App.xaml/MergedDictionaries, as Common/StandardStyles.xaml is in the basic templates. Possibly if you define multiple theme resource dictionaries that use the same keys - you could dynamically alter the merged dictionaries in App.xaml to change the theme at runtime.


You can override all system brushes, just by putting a brush with the same key into your resources:

<ResourceDictionary>
    <SolidColorBrush x:Key="ListBoxItemSelectedBackgroundThemeBrush" Color="Green" />
</ResourceDictionary>

A list of all system brushes for WinRT can be found here: http://www.win8tutorial.net/styling/windows-8-1-theme-resources/

The most tricky thing is to find the right brushes to override, since there are more than hundred of it.

Greetings

Christian http://www.wpftutorial.net


Need Your Help

How to solve a expression saved in a string?

matlab matlab-figure symbolic-math

I want to solve an expression saved in a string. I tried the following:

Boolean infinite loop possible?

loops boolean infinite

Is it possible to incur a infinite loop through the creation of a Boolean query (e.g. Library catalog or google search)?