WPF将RelativeSource绑定到祖先问题
我将一组集合绑定到WPF数据网格组件(外部库),底层的
DataSource
具有以下结构。这基本上给了我一个带有分层记录的数据网格
class DataGridItemType
{
public string weightType;
public string SourceType;
private BindingList<DataGridItem> typeCollection = new BindingList<DataGridItem>();
}
BindingList<DataGridItemType> list = new BindingList<DataGridItemType>();
list
是datagrids DataSource,它执行分层绑定。现在,我尝试使用,Text="{Binding Path=weightType, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type btm:DataGridItemType}}}
将组件(记录一级的标题标签绑定到数据源为typeCollection的层次结构中)绑定到变量weightType
但绑定不起作用。我错过了什么吗?
没有找到相关结果
已邀请:
1 个回复
土投