WPF数据网格一列作为组合框,为每行添加不同的列表



我有数据网格wpf,其中一列是combobox。对于每一行,我需要不同的项目列表。我有这种结构

public class DuplicateType:List<string>
{
public string d { get; set; }
}
public class StructurDatLegend : ObservableObject
{
public bool selected { get; set; }
public string VName { get; set; }
public View VLeg { get; set; }
public XYZ VPol { get; set; }
public  DuplicateType DuplicateT { get; set; }
}
foreach (Tuple<View, XYZ> LegItem in duplicatesheet.Getlegendcollection(vs))
{
DuplicateType o = new DuplicateType();
o.Add("tee");
o.Add("fdvxvx");  
Legend.Add(new StructurDatLegend { selected = false, VName = LegItem.Item1.Name, VLeg = LegItem.Item1, VPol = LegItem.Item2 , DuplicateT = o });
}  

如何在xaml代码中加载这些数据?此代码不起作用

<DataGridComboBoxColumn Header =" Duplicate" Width="100" x:Name="DuplicateType" DisplayMemberPath="d"  SelectedItemBinding="{Binding Path= DuplicateT}" SelectedValuePath="{Binding DuplicateT}" />

对不起,因为我的英语。您为数据网格设置了DataContext吗?在您的xaml代码中,您设置了DisplayMemberPath="d",但在后面的代码中不设置d

最新更新