Force TextBox to lost focuse when EventToCommand fired

115 Views Asked by At

I need to perform login. I'm binding Login to my ViewModel. I can't bind password from passwordBox so I pass it through EventToCommand parametrer

 <i:Interaction.Triggers>
      <i:EventTrigger EventName="Tap">
        <cmd:EventToCommand Command="{Binding LogInCommand,
                                      Mode=OneWay}"
                            CommandParameter="{Binding Password,
                              ElementName=PasswordBox,
                              Mode=OneWay}"
                            />
      </i:EventTrigger>
    </i:Interaction.Triggers>

My problem - when loginbox has focus the login in ViewModel is null. How to force lost focus when the button is tap.

1

There are 1 best solutions below

0
On

I know that is not exactly the answer to your question, but still.. You can find here a realization of login dialog using MVVM http://www.geoffhudik.com/tech/2012/2/19/windows-phone-login-navigation.html