[IronPython] AddReference to Silverlight toolkit assemblies

Jimmy Schementi Jimmy.Schementi at microsoft.com
Wed Mar 31 08:29:17 CEST 2010


Lukas,

When you use ExtensionPart, it calls Assembly.Load on each file in the zip file referenced, so you don't need to do clr.Addreference.

System.Windows.Data.dll and System.Windows.Controls.Data.dll are not DLLs in Silverlight; they are in the Silverlight SDK. So you'll have to package them up into a separate zip file which you include in your AppManfest, just like you did with the SLToolkit.zip.

~js

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Lukas Cenovsky
Sent: Tuesday, March 23, 2010 5:42 PM
To: users at lists.ironpython.com
Subject: [IronPython] AddReference to Silverlight toolkit assemblies

Hi all,
I use Silverlight toolkit in my IronPython Silverlight app. To lower bandwidth, I put all necessary Silverlight toolkit .dlls into separate file called SLToolkit.zip which I reference in AppManifest.xaml:

  <Deployment.ExternalParts>
    <ExtensionPart Source="Microsoft.Scripting.zip" />
    <ExtensionPart Source="SLToolkit.zip" />
  </Deployment.ExternalParts>

This works nicely if I don't need to reference assembly already existing in Silverlight - e.g. I do

clr.AddReference('System.Windows.Controls.Data')

and use DataGrid. Unfortunately, when I need to reference PagedCollectionView from System.Windows.Data, this approach does not work. Trying

from System.Windows.Data import PagedCollectionView

fails on ImportError: Cannot import name PagedCollectionView. Doing

import System.Windows.Data
System.Windows.Data.PagedCollectionView(some_data)

fails with AttributeError: attribute 'PagedCollectionView' of 'namespace#' object is read-only. When I try to add

clr.AddReference('System.Windows.Data')

if fails with: IOError: [Errno 2] could not find assembly: System.Windows.Data (check the Web server).

The only way how to make this work is to put System.Windows.Data.dll into .xap file and reference it with

clr.AddReferenceToFile('System.Windows.Data.dll')
from System.Windows.Data import PagedCollectionView


Is there a way to make it work when System.Windows.Data.dll is in the separate file? Or should I use another approach?

Thanks,

--
-- Lukáš
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100331/3c0d01a9/attachment.html>


More information about the Ironpython-users mailing list