Hello, I have noticed that if you have a TextBox binded to a model (two way) with a default trigger and an application bar icon button, if you enter something to that textbox and then click on the app bar icon, the event LostFocus does not get called and
that causes the "model" to be out of sync with the UI (data binding is push back to the model after the textbox looses the focus) Any ideas on how to overcome this?... Thanks!
I believe I have solved my problem; I put the following code in the AppBar routine. Just disables AppBar until TextBox loses focus (and keyboard disappears). var focusedElement = FocusManager.GetFocusedElement() as TextBox; if (focusedElement != null)
{ return; } So far, so good. Maybe of some help to you.
I have a similar situation - TextBox event LostFocus is not triggered by AppBar. I suppose that's a reasonable result - AppBar is not necessarily the same as off-focus. But then, is it possible to determine the on-focus TextBox and run its LostFocus from
the AppBar? Or would that be bad practice?
I believe I have solved my problem; I put the following code in the AppBar routine. Just disables AppBar until TextBox loses focus (and keyboard disappears). var focusedElement = FocusManager.GetFocusedElement() as TextBox; if (focusedElement != null)
{ return; } So far, so good. Maybe of some help to you.
Dim focusedElement As Control = FocusManager.GetFocusedElement()
If focusedElement IsNot Nothing Then
focusedElement.GetBindingExpression(TextBox.TextProperty).UpdateSource()
End If
Hope this could help
Faical SAID Highwave Creations
Proposed as answer byFaicalSaturday, November 24, 2012 9:55 AM
Edited byFaicalSaturday, November 24, 2012 9:59 AMBetter Solution