如何从WPF Datagrid派生DataTable [英] How to derive a DataTable form a WPF Datagrid

查看:132
本文介绍了如何从WPF Datagrid派生DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想从我的WPF DataGrid派生一个DataTable实例. DataGrid具有构成网格数据源的对象列表.我需要根据网格的内容生成报告.不幸的是,该报告无法将wpf组件用作我使用telerik报告的数据源,并且在创建实例时需要将dataTable作为参数发送.是否有捷径可寻?即使它不是DataTable而是反映Datagrid内容的其他数据结构,也可以使用.如果有更简单的方法,我并不特别希望对函数进行编程.

Thanx

Hi,

I''d like to derive a DataTable instance from my WPF DataGrid. The DataGrid has a list of objects that make up the datasource for the grid. I need to generate a report from the grid''s content. The report unfortunately can''t use wpf components as the datasource I''m using telerik reporting and need to send the dataTable as a parameter when creating an instance. Is there an easy way to do this? Even if its not a DataTable and rather some other data structure that reflects the Datagrid''s content, that would also work. I don''t particularly want to program a function to do this if there is an easier way.

Thanx

推荐答案

如何创建自己的数据网格?您是否绑定到类似ObservableCollection的东西?如果是这样,则您的集合将包装项目的各个实例,您可以将其发送到报告中(假设这里支持从IEnumerable< T>接受信息).

How did you create your datagrid? Do you bind to something like an ObservableCollection? If so, your collection wraps individual instances of items, and you could send this over to the reporting (I''m assuming it supports accepting information from IEnumerable<T> here).


这篇关于如何从WPF Datagrid派生DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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