Wpf 绑定到ItemsControl中项的DataContext

Wpf 绑定到ItemsControl中项的DataContext,wpf,data-binding,mvvm,Wpf,Data Binding,Mvvm,如何从嵌套数据模板中绑定到ItemsControl中的项的DataContext项的数据模板项的数据模板中的控件的数据模板 我不能使用TemplatedParent,因为它是双模板的。 我不知道如何使用FindAncestor和AncestorType,因为我不知道每个项目的类型 有什么想法吗?如果我读对了,你有: - ItemsControl |- ItemTemplate Item.DataContext<--| |- Button

如何从嵌套数据模板中绑定到ItemsControl中的项的DataContext项的数据模板项的数据模板中的控件的数据模板

我不能使用TemplatedParent,因为它是双模板的。 我不知道如何使用FindAncestor和AncestorType,因为我不知道每个项目的类型


有什么想法吗?

如果我读对了,你有:

- ItemsControl
  |- ItemTemplate                    Item.DataContext<--|
     |- Button                                          | 
        |- ContentTemplate <-- Bind something in this to|

如果我读对了,你有:

- ItemsControl
  |- ItemTemplate                    Item.DataContext<--|
     |- Button                                          | 
        |- ContentTemplate <-- Bind something in this to|

ContentPresenter!!这就是我要找的。谢谢经过3个小时的搜索,终于找到了!这应该有更多的选票才能显示在最前面。谢谢。内容演示者!!这就是我要找的。谢谢经过3个小时的搜索,终于找到了!这应该有更多的选票才能显示在最前面。非常感谢。