Silverlight 4 Equivalent to WPF "x:static"

AmbiguousX picture AmbiguousX · Jul 30, 2010 · Viewed 9.7k times · Source

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.

Answer

n535 picture n535 · Jul 30, 2010

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.