Jul 16, 2009

ResourceDictionary value out of range in silverlight 3 RTW

I am porting my SL 3 beta code to RTW.
After a bit of tweaks, i got past build errors. Refer to other post. And then started getting the following runtime error:

Attribute "MyAssembly;component/MyStyles.xaml" value is out of range. [Line: x Position: y]

The corresponding line in the XAML below. Position y is the equal sign after TargetType.
  • style key="ImageButton" targettype="Button"
The following is the code for MergedDictionaries reference
  • resourcedictionary source="MyAssembly;component/MyStyles.xaml"
The actual cause was the Build Action property of XAML file.
The solution steps are
1) the xaml file you are referencing should have BuildAction = Resource
2) addition of a "/" prefix to the assembly in the source:

You can read more in these links:
http://silverlight.net/forums/t/111475.aspx

http://silverlight.net/forums/p/108647/251577.aspx#251577

Also, check the section
"3.18 Effects Files (.ps) can no longer be loaded as Content"
from the list of SL3 RTW breaking changes @ http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Jul 11, 2009

Silverlight 3 RTW - Breaking Changes from 3 Beta and SL 2

Go through the link to understand all the breaking changes from SL 3 Beta and SL 2 before converting your code.

http://msdn.microsoft.com/en-us/library/cc645049(VS.95).aspx

Silverlight 3 SDK - Removed Controls

Silverlight 3 RTW removes some of the controls from the SDK. Following are some that were throwing errors in my code.

DockPanel
Expander
HeaderContentControl
ViewBox
WrapPanel

Read this link for the complete list of controls that have moved from the SDK to Silverlight Toolkit.

System.Web.Silverlight not found in Silverlight 3 release

With Silverlight 3 RTW in the wild, i tried running my existing Silverlight 3 beta code with the RTW with anticipations of broken code. I wasn't wrong. Got the first one.

The type or namespace name 'SilverlightControls' does not exist in the
namespace 'System.Web.UI' (are you missing an assembly reference?)


After a bit of searching on my system, i realised it was still referring to my Silverlight 2 libraries path. But, having uninstalled that, unresolved namespace.

After searching on the web and silverlight.net site, found out that, the "System.Web.Silverlight.dll" has been moved out of the Silverlight SDK and made available separately as ASP.NET Server Controls here. So, the fix is to get the dll from here and add it to your project as a library. There could be other ways such as installing to GAC etc, which wasn't really needed in my case.

Hope this helps.
Reblog this post [with Zemanta]