Inf*_*ris 9 data-binding wpf binding
我有一个使用数据绑定填充的项目网格.在网格中我有一个DataTemplate
特定的细胞.我需要访问DataContext
根元素(托管网格的元素),以便我可以访问其他绑定以支持我的datatemplate.
所以你有了:
Window
Window.DataContext = TheDataSourceWithItemsAndSupports
DataGrid.ItemsSource = {Binding Items}
DataTemplate
ListBox.ItemsSource = {Binding Supports}
Run Code Online (Sandbox Code Playgroud)
我希望{Binding Supports}
继续TheDataSourceWithItemsAndSupports
,但我不知道该怎么做.我试过指定,{Binding}
但总是返回null
.我也尝试过使用RelativeSource FindAncestor
,但产量null
也是如此.
有线索吗?
use*_*035 14
也许试试吧
Window Name="TheWindow"
...
ListBox.ItemsSource = {Binding DataContext.Supports, ElementName=TheWindow}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8414 次 |
最近记录: |