i got the following XAML:
<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>
It's a textbox which is bound to a string in mvvm. The problem is when i press "shift + a character" at the first letter then the event is not fired. When i press caps lock + any character, then the event will be fired as usual. It alsow works when i press any character on the keyboard.
Can anyone help me please?
Thx in advance,
Edit: Solution after the suggestion of Geert:
In the 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>
In the ViewModel (using 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);
}