【问题标题】:Can I make a custom control similar to a ContentControl editable in Blend?我可以制作一个类似于在 Blend 中可编辑的 ContentControl 的自定义控件吗?
【发布时间】:2010-10-11 16:51:59
【问题描述】:

我正在尝试使 Silverlight 中的自定义控件具有与 ContentControl 相同的功能,特别是在 Blend 中可编辑。

自定义控件有一个属性“AdditionalContent”,其中包含应显示的内容。它与控件 UI 的 Xaml 中的 ContentPresenter 绑定并一起显示。不幸的是,我的自定义控件继承自第 3 方控件,因此不能选择从 ContentControl 继承。

我查看了 HeaderedContentControl 上的 Silverlight Toolkit 代码,并将其用作指导,以使我的“AdditionalContent”属性正常工作。唯一的问题是它对 Blend 不友好。我在 Blend 中获得了一些非常基本的可编辑性,但没有 Blend 对 ContentControl 或 HeaderedContentControl 类型的平滑集成。

是否有任何类型的属性或其他我可以添加的东西,以便 Blend 知道如何处理这种情况?还是对于 ContentControl 和 HeaderedContentControl 类型的 Blend 是硬编码的?

【问题讨论】:

    标签: silverlight silverlight-toolkit blend


    【解决方案1】:

    将 [ContentPropertyAttribute] 添加到指定内容元素名称的控件。

    【讨论】:

      猜你喜欢
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 2011-02-20
      • 1970-01-01
      • 1970-01-01
      • 2012-12-19
      相关资源
      最近更新 更多