gpt4 book ai didi

wpf - 文本框绑定(bind)到 LostFocus 和属性更新

转载 作者:行者123 更新时间:2023-12-04 16:26:13 25 4
gpt4 key购买 nike

目前我绑定(bind)到我的TextBox即:

Text="{Binding DocValue,
Mode=TwoWay,
ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}"

这非常适合让每次击键都进行按钮状态检查(我想要的)。

另外,我想追踪 LostFocus TextBox 上的事件(通过绑定(bind))并进行一些额外的计算,这些计算对于每次击键来说可能过于密集。

有人对如何实现两者有想法吗?

最佳答案

为了补充最高投票的答案,dotnet core 迁移了交互库。使其工作的步骤:

  1. Remove reference to "Microsoft.Expression.Interactions" and "System.Windows.Interactivity"
  2. Install the "Microsoft.Xaml.Behaviors.Wpf" NuGet package.
  3. XAML files – replace the xmlns namespaces "http://schemas.microsoft.com/expression/2010/interactivity" and "http://schemas.microsoft.com/expression/2010/interactions"with "http://schemas.microsoft.com/xaml/behaviors"
  4. C# files – replace the usings in c# files "Microsoft.Xaml.Interactivity" and "Microsoft.Xaml.Interactions" with "Microsoft.Xaml.Behaviors"


通过 blog (Dec 2018) post here

关于wpf - 文本框绑定(bind)到 LostFocus 和属性更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15488033/

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