,我已经实现结合到不同的标签,不同的视图模型的多标签选项 用一个简单的DataTemplate结合一个视图模型到视图。
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.
为什么值消失?我假设它是清理资源WPF子系统的任务!?我怎样才能避免这种情况?我也觉得它可能会放慢我的应用程序。
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.
推荐答案
下面是创建的TabControl的一个子类的解决方案。
Here is a solution that creates a subclass of the TabControl.
http://eric.burke.name/dotnetmania/2009/ 4月26日/ 28年9月22日
相关推荐
最新文章