【发布时间】:2010-11-10 11:47:22
【问题描述】:
如何创建只读依赖属性?这样做的最佳做法是什么?
具体来说,最让我难过的是没有实现
DependencyObject.GetValue()
将System.Windows.DependencyPropertyKey 作为参数。
System.Windows.DependencyProperty.RegisterReadOnly 返回 DependencyPropertyKey 对象而不是 DependencyProperty。那么,如果您不能对 GetValue 进行任何调用,您应该如何访问您的只读依赖项属性呢?或者您是否应该以某种方式将 DependencyPropertyKey 转换为普通的旧 DependencyProperty 对象?
建议和/或代码将不胜感激!
【问题讨论】:
标签: .net wpf dependency-properties