Frage

Facts :

  1. phone:PhoneApplicationPage.ApplicationBar don't change the focused element.

  2. TextBox/PasswordBox is changeing its binded content when losing focus

So if a user is writing something in a TextBox and he click a shell:ApplicationBarIconButton then the TextBox.Text={Binding ...} is not updated.

I found this solution:

http://www.pedrolamas.com/2013/01/11/how-to-force-a-focused-textbox-binding-to-update-when-i-tap-an-app-bar-item/

But c'mon I have 20 screens with inputs, it feels like reinventing the wheel again and again!

I search for a nice/cleaner solution if there is such. Now I have to go across all click events where inputs are involved and put the magic line:

App.FocusedTextBoxUpdateSource();

Can it be set globally somehow?

War es hilfreich?

Lösung

Or you could create a custom textbox control with its text changed property bound to a command something that builds over this thread

"UpdateSourceTrigger=PropertyChanged" equivalent for a Windows Phone 7 TextBox

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top