I’m working on some Silverlight controls and I would like to explicitly handle the way they appear in Blend. Specifically, these controls have dependencies that are initialized at runtime, and thus throw exceptions in the designer. But even in the absence of the exception, I would like to make them appear a certain way in Blend.
I know that this is possible with WPF (using myassembly.VisualStudio.Design.dll), but I haven’t been able to find info on doing this with Silverlight.
I have seen the hack described here that checks does this:
bool designTime = (System.Windows.Browser.HtmlPage.IsEnabled == false);
I would prefer a more explicit solution though.
There is an extremely detailed post on how to deal with design time extensibility here. There you will find out how to do the Visual Studio and Blend design time stuff for Silverlight.
Like I said, it’s long. 🙂