通过绑定列表中的值设置Datagrid属性的值

编程入门 行业动态 更新时间:2024-10-17 21:24:57
本文介绍了通过绑定列表中的值设置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属性的值

本文发布于:2023-11-27 21:58:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639750.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   属性   列表中   Datagrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!