Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否可以在sql server数据库的表中按多个字段或列筛选我的collectionview_C#_Wpf_Collectionviewsource - Fatal编程技术网

C# 是否可以在sql server数据库的表中按多个字段或列筛选我的collectionview

C# 是否可以在sql server数据库的表中按多个字段或列筛选我的collectionview,c#,wpf,collectionviewsource,C#,Wpf,Collectionviewsource,在下面的代码中,我只能根据表中的姓氏列进行筛选,我可以使用多个表列进行筛选吗 ICollectionView view = CollectionViewSource.GetDefaultView(EmployeeView.ItemsSource); view.Filter = m => ((EmployeeMaster)m).Surname.ToLower().Contains(TextBoxSearch.Text.ToLower()); 您可以尝试通过&&或|运算符组合

在下面的代码中,我只能根据表中的姓氏列进行筛选,我可以使用多个表列进行筛选吗

ICollectionView view = CollectionViewSource.GetDefaultView(EmployeeView.ItemsSource);
        view.Filter = m => ((EmployeeMaster)m).Surname.ToLower().Contains(TextBoxSearch.Text.ToLower());

您可以尝试通过
&&
|
运算符组合条件,如下所示:

ICollectionView view = CollectionViewSource.GetDefaultView(EmployeeView.ItemsSource); 
view.Filter = m => ((EmployeeMaster)m).Surname.ToLower().Contains(TextBoxSearch.Text.ToLower()) || ((EmployeeMaster)m).Name.ToLower().Contains(TextBoxSearch.Text.ToLower());