Tuesday, October 20, 2009

Library Of The Week: Simple Styles for Silverlight

{

I’ll admit I have a Man Crush on Robbie Ingebretsen that began when I discovered his work at MIX earlier this year. To expound a bit: Microsoft has worked hard to try to draw a line in the sand between “developer” and “designer” – a line I always had a visceral dislike for because it’s always been people like Robbie Ingebretsen who I’ve always tried to pattern myself after: people who can write code AND produce beautiful designs.

One of the more difficult things I’ve encountered in Silverlight is dealing with control templates. Even something as simple as a button, when opened in Blend, involves quite a few different moving parts so that changing behavior doesn’t always produce a desired effect. For example: changing the background of the button at some given visual state will not affect the button unless you take into account a predefined background gradient that is a part of it.

The Simple Styles samples are stripped down, intuitive versions of the control templates with a concise starting point for anyone working to customize their behavior. To go back to the previous example, changing the background of a button involves changing the BackgroundElement. Rather than changing individual gradient stops in a Visual State, simple modify the entire element related to that Visual State.

Default Button Template Simple Button
102 lines of XAML 38 lines of XAML

The button is a starting point for simple conversations but there are controls like the listbox which can be deceptively unwieldy in how they are managed1.

The structure of the Simple Styles is also beautiful – not simply a resource dictionary with everything crammed together but a separate file for each control, a gesture one would think was straightforward until you see the many examples of Silverlight styles coming from Blend generated files.  

I mentioned previously that I think that the antidote to the “blank slate” of RIA is good precedent and patterns developers and designers turn to when they build things. I think Simple Styles are a step in that direction; what I wouldn’t give to look through Robbie’s resource dictionaries. How about it Robbie?

}

No comments: