I write a blog about this topic, link: http://www.cnblogs.com/redmoon/archive/2008/03/08/1096331.html It is be writed in Chinese.
On Tue, Mar 11, 2008 at 8:15 AM, Jimmy Schementi < [EMAIL PROTECTED]> wrote: > Yep, that's the way to do it =) > > Ideally, this would be abstracted away in a silverlight.py utility module > ... which I see as largely community driven ... so feel free to share > anything you think would be great to reuse across all python Silverlight > apps. > > ~js > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:users- > > [EMAIL PROTECTED] On Behalf Of Dino Viehland > > Sent: Monday, March 10, 2008 5:12 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > > > That's just Application.Current.RootVisual = myCanvas > > > > This is what I've been doing in my own Silverlight experiments, but I > > suck at using XAML and Blend :) > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:users- > > [EMAIL PROTECTED] On Behalf Of Michael Foord > > Sent: Monday, March 10, 2008 4:32 PM > > To: Discussion of IronPython > > Subject: Re: [IronPython] how to use IronPython in Silverlight 2 > > > > Jimmy Schementi wrote: > > > > > > To load a XAML file and set the RootVisual, you can do this: > > > > > > Application.Current.LoadRootVisual("file.xaml") > > > > > > It's how we do it in the python samples on > > http://dynamicsilverlight.net > > > > > > > Suppose you don't want to load a XAML file - how do you do that (but > > say > > set a 'Canvas' instance you have created programatically) ? > > > > Michael > > > > > > > ~Jimmy > > > > > > *From:* [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] *On Behalf Of *Dino > > Viehland > > > *Sent:* Friday, March 07, 2008 11:25 AM > > > *To:* Discussion of IronPython > > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > > > One problem is that XamlReader.Load takes the string of XAML and not > > a > > > filename. But there's something about the XAML that isn't working > > > right too. I'm no XAML expert but simplifying it to the code below > > > works, you can probably build something up from that. Personally for > > > my Silverlight hacking I've just been building up the tree > > > programmatically from Python code even though that's uncool J. > > > > > > from System.Windows import Application > > > > > > from System.Windows.Markup import XamlReader > > > > > > Application.Current.RootVisual = XamlReader.Load(""" > > > > > > <Canvas Width="100" Height="100" > > > xmlns="http://schemas.microsoft.com/client/2007" > > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > <TextBlock FontSize="30" Text="hello world"/> > > > > > > </Canvas>""") > > > > > > *From:* [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] *On Behalf Of *Kevin Chu > > > *Sent:* Friday, March 07, 2008 9:32 AM > > > *To:* Discussion of IronPython > > > *Subject:* Re: [IronPython] how to use IronPython in Silverlight 2 > > > > > > hi Dino > > > > > > Thanks for your reply. > > > > > > But I try my sample (look attachment), It can't run! Is my code > > mistake ? > > > > > > *IronPython code:* > > > > > > from System.Windows import Application > > > from System.Windows.Markup import XamlReader > > > > > > class App: > > > def __init__(self): > > > Application.Current.RootVisual = XamlReader.Load("app.xaml") > > > self.scene = Application.Current.RootVisual.grid > > > def start(self): > > > # TO DO: Replace this with your application start logic. > > > self.scene.message.Content = "Welcome to Silverlight and IronPython!" > > > > > > App().start() > > > > > > *XAML code:* > > > > > > <UserControl x:Class="System.Windows.Controls.UserControl" > > > xmlns="http://schemas.microsoft.com/client/2007" > > > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> > > > > > > <Grid x:Name="grid" Background="White"> > > > <TextBlock x:Name="message" FontSize="30" /> > > > </Grid> > > > > > > </UserControl> > > > > > > On Fri, Mar 7, 2008 at 11:55 AM, Dino Viehland > > > <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> > > > wrote: > > > > > > You'll need to download the Silverlight 2 SDK. After installing that > > > you'll get all the necessary components installed into something like > > > C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client. > > > Also installed is an extremely useful tool called Chiron which you'll > > > find somewhere around C:\Program Files\Microsoft > > > SDKs\Silverlight\v2.0\Tools\Chiron. Chiron can take your .py file and > > > produce a .xap which includes the IronPython & DLR DLLs using the > > > /zipdlr command line option. You can also use it to serve http > > > requests and automatically serve up the .xap and let you just edit > > the > > > files. > > > > > > So once you're ready to make your xap the directory you point at > > > should contain a .py file (I'm not sure what the multi .py file > > > experience is like, but w/ a single file the it doesn't seem the name > > > matters). The simplest thing to put in there is: > > > > > > from System.Windows import Application > > > > > > from System.Windows.Markup import XamlReader > > > > > > Application.Current.RootVisual = XamlReader.Load("someXaml") > > > > > > You can see this from the Ruby perspective over at > > > http://www.iunknown.com/2008/03/dynamic-silverl.html > > > > > > There's various options on how to deploy the DLLs, and you can get > > > into manifest files to deploy additional DLLs, but hopefully that'll > > > get you started. > > > > > > *From:* [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]> > > > [mailto:[EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED]>] *On Behalf Of *Kevin Chu > > > *Sent:* Thursday, March 06, 2008 7:39 PM > > > *To:* Discussion of IronPython > > > *Subject:* [IronPython] how to use IronPython in Silverlight 2 > > > > > > Silverlight 2 beta1 tools for VS2008 only create C# code file, > > > > > > How to create a IronPython code file? > > > > > > -- > > > Once in a Redmoon > > > > > > > > > _______________________________________________ > > > Users mailing list > > > [email protected] <mailto:[email protected]> > > > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > > > > > > > > > > > > > > -- > > > Once in a Redmoon > > > > > > --------------------------------------------------------------------- > > --- > > > > > > _______________________________________________ > > > 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 > -- Once in a Redmoon
_______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
