0
Shift +角色,我得到了下面的XAML不會觸發TextChanged事件:WPF/Catel:當文本框輸入
<TextBox TextWrapping="Wrap"
Width="300"
Text="{Binding SearchText, Mode=TwoWay,
UpdateSurceTrigger=PropertyChanged}"
VerticalContentAlignment="Center"
ToolTip="Suchbegriff eingeben.">
<i:Interaction.Triggers>
<i:EventTrigger EventName="TextChanged">
<catel:EventToCommand Command="{Binding SearchTxt_TextChangedCmd}"
DisableAssociatedObjectOnCannotExecute="False"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
這是這勢必會在MVVM一個字符串文本框。 問題是,當我在第一個字母處按「shift +一個字符」然後事件未被觸發。 當我按下大寫字母鎖+任何字符,然後事件將像往常一樣被解僱。 它也適用於我按鍵盤上的任何字符。
任何人都可以幫助我嗎?
Thx提前,
編輯:溶液吉爾特的建議之後:
在view.xaml:
<TextBox Height="31"
HorizontalAlignment="Right"
Margin="0,59,20,0"
Name="textBox2"
VerticalAlignment="Top"
Width="282"
Text="{Binding BehaviorText, Mode=TwoWay}">
<i:Interaction.Behaviors>
<catel:UpdateBindingOnTextChanged UpdateDelay="200" />
</i:Interaction.Behaviors>
</TextBox>
在(使用Catel)視圖模型:
public String BehaviorText
{
get { return GetValue<String>(BehaviorTextProperty); }
set { SetValue(BehaviorTextProperty, value); }
}
public static readonly PropertyData BehaviorTextProperty =
RegisterProperty("BehaviorText", typeof(String), null, (sender, e) => ((MainWindowViewModel)sender).OnUpdateBindingOnTextChanged());
private void OnUpdateBindingOnTextChanged()
{
Console.WriteLine(BehaviorText);
}
嗨吉爾特,thx的答案:)。你的意思是repro =再現錯誤?對不起,因爲我的英語不太好。好的將嘗試出來的建議,然後上傳示例項目,如果它不起作用。 –
嗨,它的作品,太棒了!^^ –
嗨,我嘗試了我的用戶定義的EventoToCommandClass,它與觸發器一起使用。我將上傳https://catelproject.atlassian.net上的repro –