Expression Blend 2 中 Silverlight 控件的设计时渲染
我正在开发一些 Silverlight 控件,并且我想明确处理它们在 Blend 中的显示方式。 具体来说,这些控件具有在运行时初始化的依赖项,因此会在设计器中引发异常。 但即使没有例外,我也想让它们在 Blend 中以某种方式出现。
我知道这对于 WPF 是可能的(使用 myassemble.VisualStudio.Design.dll),但我无法找到有关使用 Silverlight 执行此操作的信息。
我已经看到了描述的黑客 此处 检查执行此操作:
bool designTime = (System.Windows.Browser.HtmlPage.IsEnabled == false);
不过,我更喜欢更明确的解决方案。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有一篇非常详细的文章如何在这里处理设计时可扩展性。 在那里,您将了解如何为 Silverlight 进行 Visual Studio 和 Blend 设计时工作。
就像我说的,它很长。 :)
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. :)
要检查的特定属性是
DesignerProperties
:其中
this
是DependencyObject
(任何可视元素)。The specific attribute to check is
DesignerProperties
:where
this
is aDependencyObject
(any visual element).