Answer the question
In order to leave comments, you need to log in
How to execute command on KeyDown event for TextBox?
How to execute command on KeyDown event in TextBox?
I'm using WPF
Answer the question
In order to leave comments, you need to log in
You can use a converter i:InvokeCommandAction
from System.Windows.Interactivity
.
1) Add an assembly System.Windows.Interactivity
by adding a link (it's in the list of extensions).
2) Add the specified assembly to the xaml:
3) Use i:EventTrigger
and i:InvokeCommandAction
:
<TextBox>
<i:Interaction.Triggers>
<i:EventTrigger EventName="KeyDown">
<i:InvokeCommandAction Command="{Binding KeyDownCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question