如何将 Silverlight 控件添加到 WPF 解决方案?

发布于 2025-01-06 04:07:55 字数 1086 浏览 1 评论 0原文

总的来说,我对 WPF 和 .Net 编程有点陌生。 我已经下载了这个源代码

现在,它有一个包含 Paris.Controls csproj 的解决方案。

这最初是为 Silverlight 制作的,当我尝试添加对这些控件的输出 dll 的引用时,我收到一个错误:

               Error    1   Unknown build error, 
'Cannot resolve dependency to assembly
         'System.Windows, Version=2.0.5.0, Culture=neutral,
     PublicKeyToken=7cec85d7bea7798e' 
        because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies
         must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. 
        Line 9 Position 80.'    C:\Users\Eric\Documents\Visual Studio 
        2010\Projects\WpfApplication1\WpfApplication1\MainWindow.xaml   9   80
            WpfApplication1

经过一番谷歌搜索后,我发现这很可能是因为 Silverlight - WPF 转换。 Silverlight 使用与 WPF 不同的引用。 我认为这有点愚蠢,因为据我了解 Silverlight 是 WPF 的一个减法,但没关系。

所以我的问题是我应该做什么以及如何做? 我应该编辑 Paris.Controls 并使其 WPF 可用吗? 改变参考文献之类的东西?如果这就是我应该做的 我该怎么做? 如果没有,我有什么选择?

请大家帮忙, 您真诚的, 埃里克

I'm kinda new to WPF and .Net programming in general.
I have downloaded this Source Code.

Now, it has a solution which contains a Paris.Controls csproj.

This was originaly made for Silverlight, when i try to add referance to the outputed dll of those controls, i get an error:

               Error    1   Unknown build error, 
'Cannot resolve dependency to assembly
         'System.Windows, Version=2.0.5.0, Culture=neutral,
     PublicKeyToken=7cec85d7bea7798e' 
        because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies
         must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. 
        Line 9 Position 80.'    C:\Users\Eric\Documents\Visual Studio 
        2010\Projects\WpfApplication1\WpfApplication1\MainWindow.xaml   9   80
            WpfApplication1

After a bit of googling, i found out It's most likley because of the Silverlight - WPF transformation.
That Silverlight uses different referances then WPF.
Which is kinda dumb i think because as i understood Silverlight is a substraction of WPF, but nevermind.

So my question is what should i do and how?
Should i edit the Paris.Controls and make it WPF-Available?
Change referances and stuff like that? and if that's what i should do,
How do i do that?
And if not, what are my options?

Please help guys,
Sincerly yours,
Eric

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾挽 2025-01-13 04:07:55

你不能。

Silverlight 和 WPF 虽然非常相似,但都基于不同版本的 .NET 运行时。 WPF 使用完整版本,而 Silverlight 使用针对 Internet 优化的轻量级版本。

当您拥有源代码时,您应该能够将其合并到 WPF 控件中 - 这意味着针对完整库重新编译并修复编译器抛出的任何错误。

You can't.

Silverlight and WPF, while very similar are based on different versions of the .NET runtime. WPF uses the full version, while Silverlight uses a lighterweight version optimised for the Internet.

As you have the source code you should be able to incorporate that into a WPF control - it will mean recompiling against the full libraries and fixing any errors that the compiler throws up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文