WPF工具包MaskTextBox绑定问题

WPF工具包MaskTextBox绑定问题,wpf,xaml,wpftoolkit,Wpf,Xaml,Wpftoolkit,我有一个简单的控件,它有一个屏蔽文本框: xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" ... <extToolkit:MaskedTextBox Mask="000-000-000" Text="{Binding SerialNumber, UpdateSourceTrigger=PropertyChanged}" /> xmlns:ext

我有一个简单的控件,它有一个屏蔽文本框:

xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
...
<extToolkit:MaskedTextBox Mask="000-000-000" Text="{Binding SerialNumber, UpdateSourceTrigger=PropertyChanged}" />
xmlns:extToolkit=”http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
...
我在控件上还有一个键绑定:

<UserControl.InputBindings>
    <KeyBinding Command="{Binding SearchCommand}" Gesture="Enter" />
</UserControl.InputBindings>

问题是在执行SearchCommand时,我需要他们在屏蔽文本框中输入的值作为搜索条件。对于常规文本框,这没有问题,但显然
MaskedTextBox
控件与
PropertyChanged UpdateSourceTrigger
不能很好地配合使用


如果我点击其他地方(所以它会失去焦点),然后按enter键,它会工作,但显然我不想这样做。对于这种情况,有什么好的解决方法吗?

您必须将属性绑定到Value属性,而不是文本