目前我绑定(bind)到我的TextBox
即:
Text="{Binding DocValue,
Mode=TwoWay,
ValidatesOnDataErrors=True,
UpdateSourceTrigger=PropertyChanged}"
这非常适合让每次击键都进行按钮状态检查(我想要的)。
另外,我想追踪
LostFocus
TextBox
上的事件(通过绑定(bind))并进行一些额外的计算,这些计算对于每次击键来说可能过于密集。有人对如何实现两者有想法吗?
最佳答案
为了补充最高投票的答案,dotnet core 迁移了交互库。使其工作的步骤:
- Remove reference to "Microsoft.Expression.Interactions" and "System.Windows.Interactivity"
- Install the "Microsoft.Xaml.Behaviors.Wpf" NuGet package.
- 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"
- 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/