如何在silverlight4.0中的datagrid中动态插入行和列 [英] how to dynamically insert rows and columns in datagrid in silverlight4.0

查看:91
本文介绍了如何在silverlight4.0中的datagrid中动态插入行和列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据网格控件,想要在按钮的单击事件中插入行和列,并希望在单击事件中删除特定的行...

I have a datagrid conrol and want to insert rows and columns at the click event of a button as well as want to delete a particular rows at the click event...

推荐答案

最简单的方法是将集合设为ObservableCollection(可能还有INotifyCollectionChanged),并将项衍生自INotifyPropertyChanged.在集合和数据项中有一些较小的附加代码,您所要做的就是将集合绑定到datagrid,然后datagrid会自动进行处理.

如果您只是迷路并使用google,则可以找到更多详细的答案和示例.
The easiest way is make your collection an ObservableCollection (and possibly INotifyCollectionChanged), and the items derived from INotifyPropertyChanged. With some minor additional code in the collection and data items, all you would have to do is bind the collection to the datagrid and the datagrid will wake care of itself.

You can find more detailed answers and examples if you just cave in and use google.


您已在类似的行上发布了3-4个问题,并稍加修改.它们是基本的操作,经过初学者的了解后应该可以进行操作.

我建议您在开始编写代码之前阅读并运行网上可用的示例项目.

从此处开始:使用ADO.NET在Silverlight DataGrid中插入,更新和删除 [ ^ ]
You have posted 3-4 question on the similar line with slight modifications. They are basic operations and one should be able to do it after going through beginner knowledge.

I would suggest you to read and run sample projects available on net before starting to code.

Start from here: Insert, Update and Delete in Silverlight DataGrid using ADO.NET[^]


这篇关于如何在silverlight4.0中的datagrid中动态插入行和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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