Dino Viehland wrote:
> sn -T System.Windows.Controls.dll gets you the public key token name...   But 
> the only other way to get the entire thing is to put it in the GAC and do 
> gacutil /l.  Alternately now that you've got the types in Silverlight you 
> could display Type.AssemblyQualifiedName or Assembly.FullName.  It'd be the 
> Silverlight strong name viewer app :).
>
>   

Just worked out the 'sn.exe' path myself. The following seems to work:


import clr
clr.AddReference('System.Windows.Controls, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35')


Great!!

Michael

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
> Sent: Monday, March 10, 2008 9:22 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] Silverlight 2 Controls
>
> Thanks Dino, I really appreciate your help.
>
> Dino Viehland wrote:
>   
>> Two more possibilities which are little less ugly:
>>         1. AddReference to the fully qualified type name including strong 
>> name
>>
>>     
>
> I'm sorry to be dense - can you remind me how to get this strong name? I
> now have Visual Studio 2008 and the Silverlight tools installed.
>
> I have success with using these shiny new controls from XAML *and* with
> the following code:
>
>
> xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml")
> something = xaml.FindName('watermark')
>
> import clr
> assembly = something.GetType().Assembly
> clr.AddReference(assembly)
> from System.Windows.Controls import Button
>
> As you say, this is ugly and using the strong names would be better. :-)
>
>   
>>         2. The bits at http://dynamicsilverlight.net/ - I'm told we should 
>> recognize the assemblies for you with some changes made there
>>
>>     
>
> That is what I'm using. If anyone has success with these binaries then
> let me know what you did!
>
> Michael
>
>   
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dino Viehland
>> Sent: Monday, March 10, 2008 8:52 AM
>> To: Discussion of IronPython
>> Subject: Re: [IronPython] Silverlight 2 Controls
>>
>> This is a horrible workaround but I think it should work.  You can create 
>> the object in XAML, then get the XAML and find the object, then call 
>> GetType().Assembly on it, and then pass that off to clr.AddReference.
>>
>> I'll follow up with the Silverlight guys on our team to make sure we can do 
>> better.
>>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Foord
>> Sent: Sunday, March 09, 2008 5:22 PM
>> To: Discussion of IronPython
>> Subject: Re: [IronPython] Silverlight 2 Controls
>>
>> Dino Viehland wrote:
>>
>>     
>>> Importing I haven't actually tried, I've only used those controls from 
>>> XAML.  But you might be able to do clr.AddReference once it's in your 
>>> manifest and then be able to import.  If that works I think it's something 
>>> we can probably make automatic.
>>>
>>>
>>>       
>> If I add them to the manifest *and* add the following magic to the XAML
>> then I can read them from XAML:
>>
>>
>>
>> xmlns:c="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
>>
>> xmlns:e="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Extended"
>>
>>
>> I *really* do want to use these from code though. I tried both of the
>> following forms to add references to the new assemblies:
>>
>> import clr
>> clr.AddReference('System.Windows.Controls')
>> clr.AddReference('System.Windows.Controls.Extended')
>> from System.Windows.Controls import Button
>>
>> import clr
>> clr.AddReference('System.Windows.Controls, Version=1.0.0.0,
>> Culture=neutral, PublicKeyToken=null')
>> clr.AddReference('System.Windows.Controls.Extended, Version=1.0.0.0,
>> Culture=neutral, PublicKeyToken=null')
>> from System.Windows.Controls import Button
>>
>> Both raised the following exception:
>>
>> IOException: Could not add reference to assembly System.Windows.Controls
>>
>>
>> Any further suggestions?
>>
>> Michael
>>
>>
>>
>>     
>>> ________________________________________
>>> From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Michael Foord [EMAIL 
>>> PROTECTED]
>>> Sent: Sunday, March 09, 2008 1:09 PM
>>> To: Discussion of IronPython
>>> Subject: Re: [IronPython] Silverlight 2 Controls
>>>
>>> Dino Viehland wrote:
>>>
>>>
>>>       
>>>> This comes back to the manifest mentioned in the previous question.  You 
>>>> can update the manfiest to contain the additional assemblies which are 
>>>> included w/ the Silverlight SDK.  Those assemblies will get loaded 
>>>> allowing the XAML to parse.
>>>>
>>>>
>>>>
>>>>         
>>> If I add the following to the XML manifest:
>>>
>>>     <AssemblyPart x:Name="System.Windows.Controls.Data"
>>> Source="System.Windows.Controls.Data.dll" />
>>>     <AssemblyPart x:Name="System.Windows.Controls"
>>> Source="System.Windows.Controls.dll" />
>>>     <AssemblyPart x:Name="System.Windows.Controls.Extended"
>>> Source="System.Windows.Controls.Extended.dll" />
>>>
>>> (Taken from the Silveright controls examples) I *still* can't import
>>> WatermarkTextBox or Button... I know that it is using this manifest
>>> because errors in it are reported - or crash IE! :-o
>>>
>>> Any other suggestions?
>>>
>>> Michael
>>> htt://www.manning.com/foord
>>>
>>>
>>>
>>>
>>>       
>>>> ________________________________________
>>>> From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Michael Foord 
>>>> [EMAIL PROTECTED]
>>>> Sent: Sunday, March 09, 2008 7:15 AM
>>>> To: Discussion of IronPython
>>>> Subject: [IronPython] Silverlight 2 Controls
>>>>
>>>> Hello all,
>>>>
>>>> I'm adapting a Silverlight 2 controls example for IronPython. It is
>>>> based on:
>>>>
>>>> http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html
>>>>
>>>> It seems that the shiny new controls, like Button, ToggleButton,
>>>> WatermarkedTextBox (etc) don't come 'out of the box' with Silverlight2.
>>>>  From downloading this example I can see the example includes several
>>>> dlls - presumably ones that *extend* System.Windows.Controls.
>>>>
>>>> As a result XAML that uses elements like these throws parse errors with
>>>> not-recognised elements. I have these dlls - how do I add them to my
>>>> IronPython project? If I just add a reference to
>>>> 'System.Windows.Controls' will it use the new dlls?
>>>>
>>>> Thanks
>>>>
>>>> Michael
>>>> http://www.manning.com/foord
>>>> _______________________________________________
>>>> Users mailing list
>>>> [email protected]
>>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>> _______________________________________________
>>>> Users mailing list
>>>> [email protected]
>>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>>
>>>>
>>>>
>>>>         
>>> _______________________________________________
>>> Users mailing list
>>> [email protected]
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>> _______________________________________________
>>> Users mailing list
>>> [email protected]
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>
>>>
>>>       
>> _______________________________________________
>> Users mailing list
>> [email protected]
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>> _______________________________________________
>> Users mailing list
>> [email protected]
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>> _______________________________________________
>> Users mailing list
>> [email protected]
>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>>     
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to