gpt4 book ai didi

c# - 有没有办法指定自定义依赖属性的默认绑定(bind)模式和更新触发器?

转载 作者:IT王子 更新时间:2023-10-29 03:47:50 30 4
gpt4 key购买 nike

我想这样做,默认情况下,当我绑定(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/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com