Expression Blend 2 中 Silverlight 控件的设计时渲染

发布于 2024-07-09 06:15:22 字数 519 浏览 6 评论 0原文

我正在开发一些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鯉魚旗 2024-07-16 06:15:22

有一篇非常详细的文章如何在这里处理设计时可扩展性。 在那里,您将了解如何为 Silverlight 进行 Visual Studio 和 Blend 设计时工作。

控件供应商和编写自定义控件的人员经常发现自己希望能够为其自定义控件提供更好的体验。
然而,关于这个话题的公开信息非常缺乏。 我决定通过这篇 50 多页的短文来纠正这种情况。

就像我说的,它很长。 :)

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.

Control vendors and people who author custom controls often find themselves wishing they could give a better experience for their custom controls.
However, there’s a huge lack of public information on this topic. And I’ve decided to correct this situation with this short 50+ pages article.

Like I said, it's long. :)

恋竹姑娘 2024-07-16 06:15:22

要检查的特定属性是 DesignerProperties

using System.ComponentModel.DesignerProperties

if (DesignerProperties.GetIsInDesignMode(this))
{
}

其中 thisDependencyObject(任何可视元素)。

The specific attribute to check is DesignerProperties:

using System.ComponentModel.DesignerProperties

if (DesignerProperties.GetIsInDesignMode(this))
{
}

where this is a DependencyObject (any visual element).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文