如何在ICollectionView中过滤不需要的列(带有值的属性)? [英] How to filter unwanted columns (properties with value) in ICollectionView?

查看:99
本文介绍了如何在ICollectionView中过滤不需要的列(带有值的属性)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个带有一些记录的ObservableCollection<Customers>类(例如,使用LINQ to SQL类的Northwind数据库中的客户"表).我已经使用此类创建了ICollectionView.
现在,我想从该视图中过滤列(例如,在数据库表中删除名称",电话"之类的列).然后,我将此视图分配给datagrid控件.
如何删除CollectionView中的此类列?在此先感谢...

Hi,
I have an ObservableCollection<Customers> class with some number of records (for ex., Customers table from Northwind Database using LINQ to SQL classes). I have created ICollectionView using this class.
Now I want to filter the columns (for ex., in database table remove the columns like Name, Phone if exist) from this View. And I''ll assign this view into datagrid control.
How to remove such columns in CollectionView? Thanks in advance...

推荐答案

使用LINQ,您可以使用以下命令对类对象进行排序:
Using LINQ you can sort your class objects using:
var sortedObjects =
from a in collection01
orderby a.Property
select a;




通常在 MSDN [




Commonly covered on MSDN[^]


这篇关于如何在ICollectionView中过滤不需要的列(带有值的属性)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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