Well, I was wrong when I said it worked. Here is the scenario:
I have necessary .dlls in separate file called /SLToolkit.zip/ which I
reference in AppManifest.xaml:
<Deployment.ExternalParts>
<ExtensionPart Source="Microsoft.Scripting.zip" />
<ExtensionPart Source="SLToolkit.zip" />
</Deployment.ExternalParts>
There are the following files in /SLToolkit.zip/:
System.ComponentModel.DataAnnotations.dll
System.Windows.Controls.dll
System.Windows.Controls.Data.dll
System.Windows.Controls.Data.Input.dll
System.Windows.Data.dll
I want to use /ChildWindow/ control. It works when I use it in XAML and
load the XAML with XamlReader. But it does not work when I want to load
it from code. If fails on importing because /ChildWindow/ is not in
/System.Windows.Controls/ namespace.
I put System.Windows.Controls.dll into .xap file and test the following
in Silverlight REPL:
py> import System.Windows.Controls
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Canvas', 'CheckBox',
'CleanUpVirtualizedItemEventArgs', ...]
py> clr.AddReferenceToFile('System.Windows.Controls.dll')
=> None
py> dir(System.Windows.Controls)
=> ['Border', 'Button', 'Calendar', 'CalendarBlackoutDatesCollection',
'CalendarDateChangedEventArgs', 'CalendarDateRange', 'CalendarMode',
'CalendarModeChangedEventArgs', 'CalendarSelectionMode', 'Canvas',
'CheckBox', 'ChildWindow', 'CleanUpVirtualizedItemEventArgs', ...]
It looks like the controls from System.Windows.Controls.dll are not
merged into /System.Windows.Controls/ namespace.
Is it bug or do I do something wrong?
--
-- Lukáš
Jimmy Schementi wrote:
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-boun...@lists.ironpython.com
[mailto:users-boun...@lists.ironpython.com] *On Behalf Of *Lukas Cenovsky
*Sent:* Tuesday, March 23, 2010 5:42 PM
*To:* users@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áš
------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com