Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

Created Unassigned: Enter KeyEnvent and LostKeyboardFocus Event In Prism [10715]

$
0
0
Now I have a requirement in my project, When I lost focus from a Textbox without anything, I want to show a message.I did it now from the ViewModel with Bing a Command to the Textbox's EventTrigger.
I want to do this things when I Press the Enter Key, what I am using Now is "TextBox.InputBindings" property,But when I Trigger this Event,the Message was shown several times.Grateful to U!
Code is Under:

XAML:
<TextBox Text="{Binding Path=PatiInfo.PatiID, Mode=TwoWay, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" Name="txtPatiId" FontSize="14" Background="#D3D8DC" HorizontalAlignment="Left" Height="30" TextWrapping="Wrap" VerticalAlignment="Top" Width="420" Grid.Column="3" Grid.Row="1" >
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding LostFocusCommand}" CommandParameter="{Binding ElementName=txtPatiId}" />
</TextBox.InputBindings>
<i:Interaction.Triggers>
<i:EventTrigger EventName="LostKeyboardFocus">
<i:InvokeCommandAction Command="{Binding LostFocusCommand}" CommandParameter="{Binding ElementName=txtPatiId}">
</i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>



Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>