【发布时间】:2019-08-21 11:25:09
【问题描述】:
我正在使用 WPF 开发自定义用户控件。 我已经注册了 DependancyProperty,但我只想让它成为 OneWay 绑定。有可能做到吗? 这是我所拥有的:
public static readonly DependencyProperty CustomPrProperty =
DependencyProperty.Register(
"CustomPr",
typeof(string),
typeof(CustomView),
new FrameworkPropertyMetadata(string.Empty, OnDependencyPropertyChanged));
这样,当有人使用用户控件时,他可以使其成为 OneWay、OneWayToSource 和 TwoWay。我怎样才能使它成为只读属性?
【问题讨论】:
标签: c# wpf data-binding