I have a WPF TabControl with two TabItems. In both tabItems I have a textbox with the Text property bound to a property in my ViewModel. The problem is that the binding in the second tab (the one “hidden” by the first tab) is not working. I have two cases:
-
I run the app, I run the command that would fill the text in the second tab, I select the tab: in this case the binding works: I can see the textbox filled with data. But if I run again the command the textbox does not get updated anymore. It looks like the binding works, but only once.
-
The second case is if I run the app, and then, before running the command, I select the second tab. In this case the binding does not work at all.
If I move the second tab to the first position, then the binding will work for this tab. (but it will stop working for the other one)
Does someone knows about a worksround for that
Your ViewModel has to implement INotifyPropertyChanged interface.
Also you have to set the UpdateSourceTrigger property of your binding to “PropertyChanged”. After this changes your app should working as expected.