带有.net core 3.0的ICollectionView

编程入门 行业动态 更新时间:2024-10-27 11:16:38
本文介绍了带有 core 3.0的ICollectionView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在将项目从经典的迁移到 core 3.0.我在ViewModel ICollectionView接口中使用它,但 core 3.0框架无法识别它.

I'm migrating my project from classic to core 3.0. I use in my viewmodel ICollectionView interface and it is not recognized in core 3.0 framework.

我添加了几个nuget软件包以尝试使其正常运行,但是没有运气.

I added several nuget packages to attempt to make it work, but with no luck.

Microsoft声称System.ComponentModel定义了icollectionview( docs.microsoft/zh-CN/dotnet/api/systemponentmodel.icollectionview?view=netcore-3.0 ),但找不到.我还尝试包括Windowsbase,但也找不到.

Microsoft claims System.ComponentModel defines icollectionview (docs.microsoft/en-us/dotnet/api/systemponentmodel.icollectionview?view=netcore-3.0), but it is not found. I also tried to include windowsbase, but it's not found either.

我的环境有问题吗?我错过了什么吗?

Is my environment faulty ? Did I miss something ?

感谢您的帮助.

这是一个可在core3项目下编译的小类:

Here is a small class to compile under a core3 project:

class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); ICollectionView col =new CollectionViewSource().View; col.Filter = null; col.Refresh(); } }

感谢ALFA for Microsoft.Windows.SDK.Contracts在核心上提供ICollectionView接口,但不幸的是,它还不完整:未实现过滤器和刷新.

Thanks to ALFA for Microsoft.Windows.SDK.Contracts which offer an ICollectionView interface on core, but unfortunatly, it is not complete: Filter and refresh are not implemented.

推荐答案

您需要从以下位置编辑项目文件 YourProjectName.csproj :

You need to edit your project file YourProjectName.csproj from this:

<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> </PropertyGroup>

对此:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> <PropertyGroup> <TargetFramework>netcoreapp3.0</TargetFramework> <UseWPF>true</UseWPF> </PropertyGroup>

对我有帮助.

更多推荐

带有.net core 3.0的ICollectionView

本文发布于:2023-11-14 02:36:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585997.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:core   net   ICollectionView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!