Dev GridView 绑定List<T>、BindingList <T>、BindingSource
2023-09-14 09:03:17 时间
作者:jiankunking 出处:http://blog.csdn.net/jiankunking
今天听到同事处理数据结构的时候特意处理为了 BindingList T ,据说可以直接绑定到Dev GridView上,于是测试了一下:
1、在Dev GridView中新增三列,三列的FieldName分别对应与FormItem类对应:ItemKey、Name
在这里google的工程师们使用了标签,这个标签主要在动态插入内容时候使用,有点类似于占位符的作用。
Dev GridView 绑定List T 、BindingList T 、BindingSource 今天听到同事处理数据结构的时候特意处理为了 BindingList T ,据说可以直接绑定到Dev GridView上,于是测试了一下: 1、在Dev GridView中新增三列,三列的FieldName分别对应与FormItem类对应:ItemKey、Name、Enable 具体类代码如下: public class FormItem /// summ
错误 1 Files 的值“ .mine”无效。路径中具有非法字符。 Microsoft Visual Studio 2010项目编译的时候,提示如下错误: 错误 1 Files 的值 .mine 无效。路径中具有非法字符。 解决办法:在你的工程OBJ/DEBUG目录下,找到 工程名.csproj.FileListAbsolute.txt的文件打开并删除含有 l
A-141281 unable to get file lock, will retry ... http://gdutlzh.blog.163.com/blog/static/164746951201291903824812/I ran into this error the first time I restarted Weblogic on on
作者:jiankunking 出处:http://blog.csdn.net/jiankunking
今天听到同事处理数据结构的时候特意处理为了 BindingList T ,据说可以直接绑定到Dev GridView上,于是测试了一下:
1、在Dev GridView中新增三列,三列的FieldName分别对应与FormItem类对应:ItemKey、Name、Enable
具体类代码如下:
public class FormItem /// summary /// 标识 /// /summary public string ItemKey get; set; /// summary /// 名称 /// /summary public string Name get; set; /// summary /// 是否可用 /// /summary public bool Enable get; set; }3、在Form窗体上增加一个Buntton按钮事件,并添加Click事件,在Click事件中填充List T 、BindingList T 、BindingSource,并进行绑定测试:
BindingList FormItem itemsBindingList = new BindingList FormItem List FormItem itemsList = new List FormItem BindingSource bs = new BindingSource(); private void simpleButton1_Click(object sender, EventArgs e) for (int i = 0; i i++) FormItem fi = new FormItem(); fi.ItemKey = i.ToString(); fi.Name = Guid.NewGuid().ToString(); if (i % 2 == 0) fi.Enable = true; else fi.Enable = false; itemsBindingList.Add(fi); itemsList.Add(fi); bs.Add(fi); //this.gridControl1.DataSource = itemsBindingList; //this.gridControl1.DataSource = itemsList; this.gridControl1.DataSource = bs; }4、通过测试发现List T 、BindingList T 、BindingSource均可以绑定到Dev GridView上
5、用过Dev GridView的朋友应该知道,给Dev GridView绑定DataTable后,在GridView上的修改会同步到到DataTable上,那么问题来了Dev GridView 绑定List T 、BindingList T 、BindingSource会不会同步呢?
于是添加GridView的CellValueChanged事件,在该事件中监视变量itemsBindingList、itemsList、bs,可以发现修改也是同步的。
小注:
BindingSource第一次用,有不对的地方,还请指教!
demo下载:点击打开链接
数据源可以是实现下列接口之一的任何类型:
IList 接口,包括一维数组。List T 等!
IListSource 接口,例如,DataTable 和 DataSet 类。
IBindingList 接口,例如,BindingList 类。
IBindingListView 接口,例如,BindingSource 类。
在这里google的工程师们使用了标签,这个标签主要在动态插入内容时候使用,有点类似于占位符的作用。
Dev GridView 绑定List T 、BindingList T 、BindingSource 今天听到同事处理数据结构的时候特意处理为了 BindingList T ,据说可以直接绑定到Dev GridView上,于是测试了一下: 1、在Dev GridView中新增三列,三列的FieldName分别对应与FormItem类对应:ItemKey、Name、Enable 具体类代码如下: public class FormItem /// summ
错误 1 Files 的值“ .mine”无效。路径中具有非法字符。 Microsoft Visual Studio 2010项目编译的时候,提示如下错误: 错误 1 Files 的值 .mine 无效。路径中具有非法字符。 解决办法:在你的工程OBJ/DEBUG目录下,找到 工程名.csproj.FileListAbsolute.txt的文件打开并删除含有 l
A-141281 unable to get file lock, will retry ... http://gdutlzh.blog.163.com/blog/static/164746951201291903824812/I ran into this error the first time I restarted Weblogic on on
相关文章
- HTML中      等6种空白空格的区别
- 十六进制字节 & 十六进制转二进制
- [AWS] RTO & RPO
- [Python] List & Object spread in Python
- [Node & Testing] Intergration Testing with Node Express
- Neither BindingResult nor plain target object for bean name 'command' available as request attribute
- [Bootstrap] 2. class 'row' & 'col-md-x' & 'col-md-offset-x'
- linux deepin/debian/ubuntu apt查看软件版本 && apt安装指定版本的包
- TypeScript里的类型合并操作符&
- Column '表名.某列名' is invalid in the select list because it is not contained in either an aggregate f
- Custom tool error: Failed to generate code for the service reference ××××××. Please check other erro
- List & Label Enterprise Reporting 28.1 Crack
- 线程异常:undefined reference to 'pthread_create' 处理
- Paper:《Explainable Artificial Intelligence (XAI): Concepts&可解释的人工智能:负责任人工智能的概念、分类法、机遇和挑战》翻译与解读01
- Java List toArray(new String[0]) 的理解&List的toArray()方法详解
- 【Java编程】之 List 与数组之间的相互转换&Arrays.asList 和 ArrayList 的 subList
- 【人工智能AI2.0】清华发布了 ChatGLM-6B & 中国大模型5支学术界团队和10大产业界力量介绍
- C++语言笔记系列之十六——赋值兼容规则&多继承的二义性
- Qt 界面使用自己定义控件 "提升为"
- UVA - 10239 The Book-shelver's Problem
- 2023年网络安全自学入门:(超详细)从入门到精通学习路线&规划,学完即可就业
- Vitepress快速搭设博客&项目文档
- Java Stream 处理分组后取每组最大&Stream流之list转map、分组取每组第一条&Java 8 Collectors:reducing 示例(List分组取最值)