我有一個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