如何绑定到dataGridView中的一列 [英] how to bind on one column in dataGridView

查看:89
本文介绍了如何绑定到dataGridView中的一列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个对象集合.我只想将属性之一绑定到我的dataGridView ComboBox.

能不能请问这是否可行. WinForm

I have a collection of objects. I only want to bind one of the properties to my dataGridView ComboBox.

Can some please tell if this is doeable. WinForm

推荐答案

如果您使用的是WPF,则本文对您有帮助:
WPF DataGrid实用示例 [
If you are working in WPF this article should be of help:
WPF DataGrid Practical Examples[^]


对于DataGridViewComboBoxColumn
DataSource 属性设置为您的收藏集,然后
ValueMemberDisplayMember 属性更改为所需的属性.

这里给出一个例子
http://msdn.microsoft.com/en-us/library/system. windows.forms.datagridviewcomboboxcolumn.aspx [ ^ ]
For DataGridViewComboBoxColumn
set the DataSource property to your collection and
ValueMember, DisplayMember properties to the property you want.

An example is given here
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcomboboxcolumn.aspx[^]


这篇关于如何绑定到dataGridView中的一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆