System.Windows.DependencyProperty 与 System.Workflow.ComponentModel.DependencyProperty

发布于 2024-07-14 16:06:41 字数 555 浏览 6 评论 0原文

.NET Framework 似乎有 DependencyProperty 对象的两种实现

  1. 系统.Windows.DependencyProperty
  2. System.Workflow。 ComponentModel.DependencyProperty

我知道第一个的正常使用是在WPF中,第二个的正常使用是在WF中,但是它们之间有什么区别(如果有的话)?
如果我没有使用 WPF/WF 并且仍然想使用 DependencyProperty,那么最好使用哪个?
未来有合并的计划吗?

The .NET Framework seems to have two implementations of the DependencyProperty object

  1. System.Windows.DependencyProperty
  2. System.Workflow.ComponentModel.DependencyProperty

I understand that the normal use of the first one is in WPF and the normal use of the second one is in WF but what are the differences between them if any?
If I was not using WPF/WF and still wanted to use a DependencyProperty which would be best to use?
Any plans to merge to one in the future?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

乙白 2024-07-21 16:06:41

区别很微妙,但非常明显:

System.Windows.DependencyProperty 专注于处理任何 WPF 依赖对象的依赖属性,您可以使用有关属性元数据的可选附加信息(例如度量、动画和属性)来注册它。许多 WPF 特定的。

为什么? 因为可以使用 PropertyMetadata 的派生类进一步指定此依赖属性。
这包括 WPF 的 UIPropertyMetadata 和 FrameworkPropertyMetadata,用于高级注册 WPF 依赖项属性。

System.Workflow.ComponentModel.DependencyProperty只能注册为简单的依赖属性,而不需要特定WF的PropertyMetadata的附加信息。

目前,还没有整合它们的计划,因为它们在概念和上下文上都是不同的。

The difference is subtle but it's quite clear enough:

System.Windows.DependencyProperty is focused toward handling dependency property of any WPF dependency object, and you can register it with optional additional information about the metadata of the property, such as measures, animatable, and many WPF specific.

WHy? Because this dependency property can then be further specified using derived classes of PropertyMetadata.
This includes WPF's UIPropertyMetadata and FrameworkPropertyMetadata for advanced registration of WPF dependency property.

System.Workflow.ComponentModel.DependencyProperty can only register as a simple dependency property, without needing additional information of specific WF's PropertyMetadata.

At present, there's no plan to integrate them, since both of them are conceptually and contextually different.

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