views:

351

answers:

2

I have created a Silverlight project which also contains a Web project.

I have a few class files in my web project which use System.Windows.Point and System.Windows.Size data types and I am getting compile errors when I try to pass either of these types in a List like List<Point> in the Silverlight project. If I try without the List<> I still get the Point data type error.

I reviewed information about compiling Silverlight assemblies from David Betz site I found a tool to help me used the first of the two approaches he discusses and have successfully compiled the runtime and referenced it in my Silverlight project.

Here are the errors:

  • The type 'System.Windows.Point' is defined in an assembly that is not referenced. You must add a reference to assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. C:\Documents and Settings\Gary\My Documents\Visual Studio 2008\Projects\GEP.Reports.Spatial\GEP.Reports.Spatial\MainPage.xaml.cs
  • cannot convert from 'System.Collections.Generic.List [c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]' to 'System.Collections.Generic.List [c:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]

What step am I missing in order to get these types added to my Silverlight runtime.

Thanks for any help.

Gary

+1  A: 

For simple types like Point and Size you are better off rolling your own structs/classes rather than trying to find ways of referencing non-Silverlight assemblies. In addition you don't really want something like the System.Windows assembly being included in your .xap for the sake of something like the Point struct.

sipwiz
I created a struct but when I actually needed to use System.Windows.Point in code I got an error stating something like "could not convert <my namespace>.<struct name> to System.Windows.Point". I tried casting to a point but that didn't seem to work either.
gcomstock
Actually I just checked and the Point struct is in the Silverlight libraries so you don't need to create it http://msdn.microsoft.com/en-us/library/system.windows.point(VS.95).aspx. Do you have a refence to System.Windows in your SL project?
sipwiz
A: 

actually you can use System.Windows.Point. Just in your WS use SL dll:

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll

Egis