More on skins RRS feed

  • Question

  • Hi All,

    I was reading an earlier post on skins and (as I didn't want to hijack the thread) wanted to ask a question based on skinning that has been driving me round the bend.

    I have a layout that includes a rectangular shape as a background for some buttons. I need to create a Windows System theme as well as the default theme, which needs to (unsurprisingly) use system colours. I have the rest of the design working fine but this final bit is driving me bonkers.

    I have tried the background as both a rectangle shape and a border which works if I am just applying a brush directly to the shape or border. However as I have to save it to the resource dictionary, I need to be able to apply the styles either to the control template or as a brush.

    If I use a brush for the system colours, it won't work in the default theme as they'd need to be called the same thing in each theme but I can't seem to create a resource for the border the same way I would for a normal control (like a toolbar, expander etc)

    Does anyone have any ideas as to how to get around this? Would be really grateful.

    Wednesday, June 18, 2008 2:33 PM

All replies

  •  I don't think I completely understand your question. If you could point me to a simple project that demostrates your setup, I could take a look.

    Monday, June 23, 2008 6:41 AM
  •  You can make a Resource of a Brush:

    <SolidColorBrush x:Key="systemBrush" Color="{DynamicResource {x:Static SystemColors.ColorBrushKey}}" />

    You could use this brush in other Themes:

    <SolidColorBrush x:Key="systemBrush" Color="{DynamicResource mySpiffyColor"} />

    Of course you would need a SpiffyColor: <Color x:Key="mySpiffyColor" A="#FF" R="#FF" G="#80" B="#00" />

    Tuesday, June 24, 2008 4:29 PM
  • I don't think I phrased my question as well as I could have but I've sorted out a solution for it now. What I needed was to create a gradientbrush that had system colours for each of the colour stops. I didn't know that you could do that but I have discovered now that it's quite possible using the system colours tab on the brushes menu.

    Thanks though.
    Wednesday, June 25, 2008 11:53 AM