我有一个TabControl
绑定到ICollectionView
从ObservableCollection<EditorTabViewModel>
派生。我认为相当标准的MVVM多文档模式?无论如何,EditorTabViewModel
有一个属性Content
包含要显示的字符串。我发现,结合工作...绑定不提交?
// Add 2 default tabs for a test, also set their Content property to the respective values ...
_tabs.Add(new EditorTabViewModel { Content = "Tab 1" });
_tabs.Add(new EditorTabViewModel { Content = "Tab 2" });
它的值是正确呈现
XAML
<!-- DataTemplate to render EditorTabViewModels -->
<DataTemplate DataType="{x:Type vm:EditorTabViewModel}">
<me:MarkdownEditor
TextContent="{Binding Path=Content.Content, RelativeSource={RelativeSource Mode=TemplatedParent}, Mode=TwoWay}"
Options="{Binding Path=Options, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" />
</DataTemplate>
结果
但是,当我改变值,开关选项卡和回报,我得到的字符串在构造函数中重新设置......显示在this video (on screenr)
Mediafire不允许我下载源代码。据推测,因为来自我所在地区的很多人正在尝试从它下载某些内容。 – 2010-11-20 14:48:39