是否可以将列表绑定到WinForms中的ListView? [英] Is it possible to bind a List to a ListView in WinForms?

查看:111
本文介绍了是否可以将列表绑定到WinForms中的ListView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将ListView绑定到列表< string> 。我正在使用以下代码:

I'd like to bind a ListView to a List<string>. I'm using this code:

somelistview.DataBindings.Add ("Items", someclass, "SomeList");

我收到此异常:无法绑定到属性Items,因为它被读取

I'm getting this exception: Cannot bind to property 'Items' because it is read-only.

如果Items属性是只读的,我不知道如何绑定?

I don't know how I should bind if the Items property is readonly?

推荐答案

ListView类不支持设计时间绑定。 此项目中提供了一种替代方案。

The ListView class does not support design time binding. An alternative is presented in this project.

这篇关于是否可以将列表绑定到WinForms中的ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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