Jerry Nixon @Work: Walkthrough: Dynamically Skinning your Windows 8 App

Jerry Nixon on Windows

Friday, January 11, 2013

Walkthrough: Dynamically Skinning your Windows 8 App

imageOne powerful feature of XAML is the ability to make any control look however the developer or designer wants without having to change the control itself. Similar to, but far more powerful than CSS, skinning a control in XAML lets you change how it looks, change the type of control, and even inject behavior.

You can change its behavior, customize it’s API, and even add properties as needed. Taken to the extreme, it can actually be a little confusing. But used appropriately, it’s a powerful, time-saving feature.

Note: since the beginning of XAML, Blend has been the superior tool to re-template and style controls. Having said that, most XAML developers know how to do the same thing by hand. Having said that, some people like to code in Notepad. To each their own, even the borgas frats.

Here’s what I want to do

I want to crate more than one style for my app. And I want to enable the user to change between my available styles to suit their preference. To accomplish this in XAML we move our styles not to a Resources property but up and out into a Resources Dictionary file. Then we can change references to different files. Wonder what I mean? Watch this:

Best of luck!