【发布时间】:2009-10-21 14:57:33
【问题描述】:
public class FontType
{
...
public String Name { get { return _name; } }
public String DisplayName { get { return _displayName; } }
public Font UseFont { get { return _font; } }
}
bindFontTypes.DataSource = availableFonts;
comboFontType.DataSource = bindFontTypes;
comboFontType.ValueMember = "Key";
comboFontType.DisplayMember = ...???;
这里,bindFontTypes 是 BindingSource。 availableFonts 是一个哈希表,其中键是字符串,值是 FontType 的对象。对于comboFontType.DisplayMember,我想使用对象的 .DisplayName 属性。我该如何指定?有可能吗?
【问题讨论】:
标签: c# winforms data-binding combobox hashtable