[IronPython] how to use IronPython in Silverlight 2

Kevin Chu redmoon17 at gmail.com
Fri Mar 7 18:31:44 CET 2008


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 <dinov at exchange.microsoft.com>
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:* users-bounces at lists.ironpython.com [mailto:
> users-bounces at lists.ironpython.com] *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
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
>


-- 
Once in a Redmoon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080308/a53343db/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: IPSL2.zip
Type: application/zip
Size: 4890 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080308/a53343db/attachment.zip>


More information about the Ironpython-users mailing list