Wednesday, 11 September 2013

DataTemplate on TabControl DataSource

DataTemplate on TabControl DataSource

I am trying to use TabControl to house some ViewModels to Views.
<TabControl SelectedIndex="{Binding QuestionIdx, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding
ProblemsVM}">
<TabControl.ContentTemplateSelector>
<problemSlector:ProblemsViewSelector>
<problemSlector:ProblemsViewSelector.ProblemTemplate>
<DataTemplate>
<views:FreeResponseView />
</DataTemplate>
</problemSlector:ProblemsViewSelector.ProblemTemplate>
</problemSlector:ProblemsViewSelector>
</TabControl.ContentTemplateSelector>
</TabControl>
. . . I've deubgged and confrimed (OnDataContextChanged) that the
DataContext of FreeResponseView is FreeResponseViewModel. The
FreeResponseView appears and the Title of the tab is correct. However, in
the FreeResponseView I have the following line that does not seem to work.
<toolkit:RichTextBox Text="{Binding Question, Mode=OneWay}" />
It is not binding the Question from the DataSource.

No comments:

Post a Comment