Value of text box disapears - binding viewmodel to a tab (content control)
Posted
by Eli Perpinyal
on Stack Overflow
See other posts from Stack Overflow
or by Eli Perpinyal
Published on 2010-05-14T15:38:02Z
Indexed on
2010/05/18
0:30 UTC
Read the original article
Hit count: 534
Based on the MVVM example by Josh Smith, I have implemented the multi tab option which binds to a different tab to a different view model using a simple datatemplate that binds a viewmodel to a view.
<DataTemplate DataType="{x:Type fixtureVM:SearchViewModel}">
<SearchVw:SearchView/>
</DataTemplate>
The issue that I'm having, is when I switch tabs and then switch back again, the value in the textbox disappears. When I bind the Text in the textbox to a value in the ViewModel it does not disappear. This is fine, and I can overcome this but I am having another issue for example with the position of the scroll bar in a grid disappearing once the tab has lost focus.
Why is the value disappearing? I'm assuming it is a WPF sub system task that cleans up resources!? how can I avoid this? I also feel it might be slowing down my app.
© Stack Overflow or respective owner