Silverlight 4相当于WPF“x:static” [英] Silverlight 4 Equivalent to WPF "x:static"

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

问题描述

我正在开发一个项目,该项目基于有人开始的旧项目,但没有完成。我试图尽可能多地使用他们的代码,所以在这样做遇到了一些调整问题。



也就是说,当我把一些旧的xaml在新项目中有一些关于x:static属性和动态属性的错误。



这里是错误消息本身:


错误1:类型DynamicResource不是
。验证您没有缺少
程序集引用,并且所有
引用的程序集都已构建。



错误2:类型'x:Static ' 没找到。
验证您没有缺少一个
程序集引用,并且所有的
引用的程序集都已生成。


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



我意识到有WPF和Silverlight的差异,就xaml去,有很多与不同的.Net框架版本和Visual Studio的版本的差异。但我似乎找不到这个任何地方的修复,所以我不知道是否只有一个图书馆我失踪了,或只是一些我只是俯瞰或什么。



我可以重新创建这个如果需要,但是像我说的,我宁愿使用尽可能多的旧代码,只要调整不会造成更多的麻烦,它的价值。不过,您无法直接使用 DynamicResource 静态关键字在Silverlight的XAML子集中,但你可以模仿他们的行为。以下是有关此主题的文章:





一般来说,没有简单的方法将项目从WPF迁移到Silverlight。他们有很多共同点,但严格来说是不同的技术。


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.

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."

here are the error messages themselves:

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.

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.

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.

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.

解决方案

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:

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天全站免登陆