Quantcast
Channel: Pocket Silicon - Cider
Viewing all articles
Browse latest Browse all 20

The Design Mode Property Redux

$
0
0

When we were looking at our options for adding a design mode property to WPF, an obvious choice was to add a dependency property to WPF that the designers would use. None of us remotely thought we could get something like that into WPF at this time. WPF ships with Vista, and Vista is down to fixing "level five recall class super double probation bugs". Or something like that. So, Sparkle and Cider knocked our heads together and came up with a late bound way of accessing a dependency property that we would each define in our own applications.

I got some solid feedback when I posted our solution. Nothing quite as strong as, "you're an idiot for doing this", but pretty close. That's one of the tricky things about working on a product designed for software developers. Developers who have shipped software know that shipping sometimes involves compromise, so you rarely get huge "you're an idiot" flames when things aren't quite right. It's great to have customers who are pragmmatic, but it's important to be able to read between the lines and push changes that need to be made.

I brought up our current design mode solution at a Cider architects meeting and we hashed out a better solution. We decided that if we could convince a WPF architect of the value, we'd have a better chance of getting this change into WPF with him at our side. After a quick email volley we had agreement from WPF that this was a good thing to pursue, even if it was very very late.

To better our chances, Cider took on all the costs. I coded the solution in the WPF codebase so we didn't require any dev resources. The Cider team also wrote unit tests, specs and documentation for the feature, so we had all those angles covered too. When we presented this to Vista shiproom, we didn't meet any of the bug bars, but shiproom agreed this was a blocking issue for Cider and needed to get fixed.

So, there you have it. Windows changelist #184261, checked in only yesterday. With this change we have a new class that looks something like the following:

public static class DesignerProperties {
    public static readonly DependencyProperty IsInDesignModeProperty;
    public static bool GetIsInDesignMode(DependencyObject element);
    public static void SetIsInDesignMode(DependencyObject element, bool value);
}

This class lives in PresentationFramework, which is part of WPF. The property inherits, and works in user controls, templates and styles. You can even data or template bind to it in XAML. Designers will set this property and there will never be a need to grovel in the app domain data.


Viewing all articles
Browse latest Browse all 20

Trending Articles