0

嗨,我有一本绑定到绑定源的字典。我想在列表框中显示键。所以我将绑定源添加到列表框并将显示成员设置为“键”。这不起作用。它给了我字典的tostring而不是键字符串......

使用的代码:

        bs_directions.DataSource = bs_measurements;
        bs_directions.DataMember = "zielwertdict"; //(=Dictionary<string,list<object>>)

        listBox3.DataSource = bs_directions;
        listBox3.DisplayMember = "Key";

更新: bs_measurements 是绑定到另一个列表框的另一个列表。当我构建项目时,listBox3 会显示字典的键。当我更改绑定到 bs_measurement 的列表框中的项目时,listbox3 会显示 dictionary.Tostring() 的东西......非常奇怪......

更新 2: bs_measurment 列表中包含的对象有一个字典(zielwerdict)和一个哈希表:

public class bs_measurementOBject
{
public string name;
public SortedDictionary<string,list>object>> zielwertlist;
public Hashtable block;
}
4

1 回答 1

0

在上面的例子bs_directions.DataMember中必须为 NULL

于 2013-07-08T08:15:30.763 回答