我有一个绑定到可观察集合的数据网格:
System.Collections.ObjectModel.ObservableCollection<vadcGridListaClass> vadcGridList = new System.Collections.ObjectModel.ObservableCollection<vadcGridListaClass>();
vadcGridListaClass的类是:
class vadcGridListaClass
{
public int ID { get; set; }
public int CU { get; set; }
public int reals { get; set; }
public int groups { get; set; }
public Boolean L7 { get; set; }
public Boolean VRRP { get; set; }
public string vrrpType { get; set; }
public Boolean L3Gateway { get; set; }
public string healthChecks { get; set; }
public DataGridComboBoxColumn service = new DataGridComboBoxColumn();
public List<string> serviceList = new List<string>();
}
我的问题是,当我向vadcList添加项目时,我会看到除组合框列之外的所有列。 列表的添加值在此部分:
vadcGridListaClass vadcItem = new vadcGridListaClass();
vadcItem.CU = 1;
vadcItem.ID = i;
vadcItem.groups = 0;
vadcItem.healthChecks = "ICMP";
vadcItem.L3Gateway = false;
vadcItem.L7 = false;
vadcItem.reals = 0;
vadcItem.VRRP = false;
vadcItem.vrrpType = "Main";
vadcItem.serviceList.Add("HTTP");
vadcItem.service.ItemsSource = vadcItem.serviceList;
vadcGridList.Add(vadcItem);
at the end I have:
vadcGrid.ItemsSource = vadcGridList;
vadcGrid.AutoGenerateColumns = true;
所以我可以看到vadcGrid中的所有列,根据vadcGridList,但是服务组合框列应该是我得到的空白列,我不知道问题出在哪里。
阿米尔