Thursday, December 22, 2011

Playing with Ironpython and Silverlight

Ironpython plays nicely with Silverlight, especially when using

Here is how I manage to pass arguments to a 'click event' handler,
assuming you have a button whith an id equal to 'Button1'

<script type="text/python">
        import System
        from System import EventHandler
        class Person(object):
            def __init__(self, name):
       = name
                self.greeted = False        
        def GreetHandler(p):
            def SayHello(s,e):
                if not p.greeted:
                    window.Alert("Hello " +                    
                    window.Alert("Happy to see you again  " +
                p.greeted = not p.greeted        
            return SayHello
        p = Person("PAUL")