Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# C Winforms将RadTreeView元素绑定到数据源,ValueMember异常_C#_Winforms_Treeview_Radtreeview_Valuemember - Fatal编程技术网

C# C Winforms将RadTreeView元素绑定到数据源,ValueMember异常

C# C Winforms将RadTreeView元素绑定到数据源,ValueMember异常,c#,winforms,treeview,radtreeview,valuemember,C#,Winforms,Treeview,Radtreeview,Valuemember,我在将RadTreeView元素绑定到数据源时遇到了一个问题,实际上是在设置ValueMember时。简言之,有: 型号: /// Parent public class EmfLocation { public int ID { get; set; } public string Name { get; set; } public virtual ICollection<EmfDataSet> EmfDataSets { get; set; } } //

我在将RadTreeView元素绑定到数据源时遇到了一个问题,实际上是在设置ValueMember时。简言之,有:

型号:

/// Parent
public class EmfLocation 
{
    public int ID { get; set; }
    public string Name { get; set; }
    public virtual ICollection<EmfDataSet> EmfDataSets { get; set; }
}

/// Child
public class EmfDataSet
{
    public int ID { get; set; }
    public string Name { get; set; }
    public int EmfLocationID { get; set; }
}
怎么了

/// treeDataset = new Telerik.WinControls.UI.RadTreeView();

private void GetTreeData()
{
    IList<EmfLocation> locationList = new List<EmfLocation>();
    locationList = repoEmfLocation.GetBy(testingId).ToList();

    treeDataset.DataSource = locationList;
    treeDataset.DisplayMember = "Name\\Name";
    treeDataset.ChildMember = "locationList\\EmfDataSets";
    treeDataset.ValueMember = "ID\\ID";
}
"Property accessor 'ID' on object 'System.Data.Entity.DynamicProxies.EmfDataSet_5F54359CCE6567583EDAE4FA2B61B7D274184C3985DAC9FE14B234AFFEE42F1B' threw the following exception:'Object does not match target type.'"