Silverlight 4 等效于 WPF “x:static" [英] Silverlight 4 Equivalent to WPF "x:static"

查看:22
本文介绍了Silverlight 4 等效于 WPF “x:static"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开展一个项目,该项目基于某人开始但未完成的旧项目.我试图尽可能多地使用他们的代码,因此在这样做时我遇到了一些调整问题.

I'm working on a project that is based on an old project someone started and didn't finish. I was trying to use as much of their code as I could, so in doing so I ran into some tweaking issues.

也就是说,当我将一些旧的 xaml 放入新项目时,会出现一些关于x:static"属性和Dynamic 属性"的错误.

Namely, when I put some of the old xaml in the new project there were some errors that were thrown regarding the "x:static" property and "Dynamic property."

这里是错误信息本身:

错误 1:DynamicResource"类型不是成立.确认您没有失踪一个程序集参考和所有已构建引用的程序集.

Error 1: The type 'DynamicResource' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

错误 2:未找到类型x:Static".确认您没有遗漏装配参考和所有已构建引用的程序集.

Error 2: The type 'x:Static' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

我认为导致错误的一些值得注意的点:旧项目是在 VS2008、WPF、v3.5 .Net 框架中编程的;而我在 VS2010、Silverlight 4、.Net framework v4.0 中编程.

Some notable points that I think is causing the errors: the old project was programmed in VS2008, WPF, v3.5 .Net framework; whereas I am programming in VS2010, Silverlight 4, .Net framework v4.0.

我意识到就 xaml 而言,WPF 和 Silverlight 之间存在差异,并且不同的 .Net 框架版本和 Visual Studio 版本也存在很多差异.但我似乎无法在任何地方找到解决方案,所以我不知道是我遗漏了一个图书馆,还是我只是忽略了一些东西.

I realize there are differences from WPF to Silverlight as far as xaml goes and there are plenty of differences from the different .Net framework versions and editions of Visual Studio. But I just can't seem to find a fix for this anywhere so I didn't know if there was just a library I was missing or just something I'm simply overlooking or what.

如果需要,我可以重新创建它,但就像我说的,我宁愿使用尽可能多的旧代码,只要调整不会造成比其价值更多的麻烦.

I can recreate this if need be, but like I said, I'd rather use as much of the old code as I can as long as the tweaking doesn't cause more trouble than what it's worth.

推荐答案

很遗憾,您不能在 Silverlight 的 XAML 子集中直接使用 DynamicResourceStatic 关键字,但你可以模仿他们的行为.这是有关该主题的文章:

Unfortunately, you can't directly use the DynamicResource and Static keywords in a Silverlight's subset of XAML, but you can mimic their behavior. Here is the article on the topic:

通常,没有简单的方法可以将项目从 WPF 迁移到 Silverlight.它们有很多共同点,但严格来说是不同的技术.

In general, there is no easy way to migrate a project from WPF to Silverlight. They have very much in common, but strictly speaking are a different technologies.

这篇关于Silverlight 4 等效于 WPF “x:static"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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