How do I update the view after not changing the viewmodel binding source? #17131
Unanswered
Justin113D
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a
TextBox
with aMode=TwoWay
binding to a ViewModel andUpdateSourceTrigger=LostFocus
. In the ViewModel, whitespace gets trimmed on setting, something like this:In other words, upon losing focus, i want the
TextBox
to update and remove all whitespace at the start and end. The issue is that, when the only thing i do is add whitespace, the value behind the binding does not change, and so the text in the UI does not change either, meaning the whitespace remains.I have no idea how to properly make it update and have it remove the whitespace after adding whitespace, but i did find a reliable workaround:
Essentially, i do make a change, tell the ui to update with it, change it back, and tell the UI to update again. This works, but is ugly. Is there a better solution?
Workaround in action:
Beta Was this translation helpful? Give feedback.
All reactions