通过绑定列表中的值设置Datagrid属性的值 [英] Setting the value of a Datagrid Property through a value from a Binding List

查看:117
本文介绍了通过绑定列表中的值设置Datagrid属性的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
这是一个WinForms应用程序.我一直试图弄清楚这一点,但没有成功.我正在将数据网格绑定到BindingList.该列表当前包含ID,成员名称和状态.包含datagrid的属性?并根据列表中的内容设置/更改该属性吗?

因此,对于该成员,状态可以是NEW或OLD.基于此,我将选择在数据网格中显示的图像.

因此,基本上,我将检查成员的状态,并希望将该属性放置在BindingList<>中.

这有可能吗?
感谢您的任何建议.

Hi All,
This is a WinForms application. I have been trying to figure this out for a while with no success. I am binding a datagrid to a BindingList<>. The list currently contains an ID and Member Name, and Status.Is it possible for this Binding List<> to contain a property for a datagrid ? And have that property set/changed based on what is in the list?

So for the status the member can be NEW or OLD. Based on this I will select which image is being displayed in the datagrid.

So basically, I am going to check what the status is of the member and want to places the property in the BindingList<>.

Is this at all posssible?
Thanks for any advice.

WindowsFormsApplication1.Properties.Resources.New_BUBBLE
WindowsFormsApplication1.Properties.Resources.Old_BUBBLE

推荐答案

尝试在网格的CellFormatting事件中进行操作.获取正在生成的行,因此您还可以获取"Status"属性的值,现在您可以基于该属性在所需列中设置图像.
链接可能会对您有所帮助.

我还没有尝试过,所以让我知道它是否有效.
Try to do the manipulation in CellFormatting event of the grid. Get the row being generated and hence you can get the value of "Status" property as well, now based on that you can set the image in required column.
This link might help you.

I''ve not tried this, so let me know if it works.


这篇关于通过绑定列表中的值设置Datagrid属性的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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