`
peizhiinfo
  • 浏览: 1426630 次
文章分类
社区版块
存档分类
最新评论

DevExpress ComboBoxEdit 实现 键值

 
阅读更多

http://www.wpf123.com/news/?143.html


定义 combox绑定类:

public class ComboxData

{

public string Text{ set; get; }

public string Value{ set; get; }

public override string ToString()

{

return Text;

}

}

具体绑定:

DevExpress.XtraEditors.ComboBoxEdit combox;

ComboxData data = new ComboxData();

data.Text ="需要显示的文本";

data.Value= “类似Tag功能”;

combox.Properties.Items.Add(data);

由于我们重写了ToString()方法,这样绑定后就可以显示我们重写内容里面的文本

使用:

string text=(combox.SelectedItem as ComboxData).Text;

string value=(combox.SelectedItem as ComboxData).Value;


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics