且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在silverlight4.0中的datagrid中动态插入行和列

更新时间:2022-12-12 17:00:44

最简单的方法是将集合设为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[^]