C# 在绑定的datatemplate中绑定单独的数据源

C# 在绑定的datatemplate中绑定单独的数据源,c#,xaml,binding,uwp,C#,Xaml,Binding,Uwp,我在flipview中有以下简单的数据模板 <FlipView x:Name="MyFlipview" ItemsSource="{x:Bind Path=ViewModel.Fleas}" > <FlipView.ItemTemplate> <DataTemplate x:DataType="types:FleaType"> <TextBox x:Name ="Header

我在flipview中有以下简单的数据模板

<FlipView x:Name="MyFlipview" ItemsSource="{x:Bind Path=ViewModel.Fleas}" >
       <FlipView.ItemTemplate>
            <DataTemplate  x:DataType="types:FleaType">     
               <TextBox x:Name ="Header" Text= "{Binding Path = ViewModel.GeneralComment}"></TextBox> 
               <TextBox x:Name ="FleaName" Text= "{Binding Path = FleaName}"></TextBox>

            </DataTemplate>
       </FlipView.ItemTemplate>
</FlipView>
但是我不知道如何将标题文本框绑定到viewmodel上的generalcomment,因为generalcomment不是跳蚤集合的一部分。如果有人知道如何做到这一点,我们将不胜感激

谢谢

您正在寻找相关资源:


谢谢,但这似乎不起作用,我想那是因为UWP中不支持ancestortype。@GeorgeT哦,好吧,这不是一场彻头彻尾的噩梦吗。唉,我发现了其他可能有用的东西,我会更新我的答案。实际上我只是在看那篇文章,但你省去了我把它应用到这个问题上的麻烦。再次感谢,现在一切都好了。
<FlipView x:Name="MyFlipview" ItemsSource="{x:Bind Path=ViewModel.Fleas}" >
       <FlipView.ItemTemplate>
            <DataTemplate  x:DataType="types:FleaType">     
               <TextBox x:Name ="Header" Text= "{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext.GeneralComment}"></TextBox> 
               <TextBox x:Name ="FleaName" Text= "{Binding Path = FleaName}"></TextBox>

            </DataTemplate>
       </FlipView.ItemTemplate>
</FlipView>
{Binding ElementName=MyUserControl, Path=DataContext.GeneralComment}