2011-07-26 92 views
0

我有一个简单的控制,有一个蒙面文本框:WPF工具包MaskTextBox绑定问题

xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended" 
... 
<extToolkit:MaskedTextBox Mask="000-000-000" Text="{Binding SerialNumber, UpdateSourceTrigger=PropertyChanged}" /> 

我也有一个键上的控制绑定:

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

问题是,当SearchCommand是执行我需要他们在掩码文本框中输入的值作为搜索条件。使用常规文本框这是没有问题的,但显然MaskedTextBox控制不能很好地与PropertyChanged UpdateSourceTrigger发挥。

如果我点击其他地方(所以它失去了重点),然后按回车它的作品,但显然我不想这样做。这种情况有什么好的解决方法吗?

回答