我想这样做,默认情况下,当我绑定(bind)到我的依赖项属性之一时,绑定(bind)模式是双向的,更新触发是属性更改。有办法做到这一点吗?
这是我的依赖属性之一的示例:
public static readonly DependencyProperty BindableSelectionLengthProperty =
DependencyProperty.Register(
"BindableSelectionLength",
typeof(int),
typeof(ModdedTextBox),
new PropertyMetadata(OnBindableSelectionLengthChanged));
最佳答案
注册属性时,初始化元数据:
new FrameworkPropertyMetadata
{
BindsTwoWayByDefault = true,
DefaultUpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
}
关于c# - 有没有办法指定自定义依赖属性的默认绑定(bind)模式和更新触发器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2663965/