[IronPython] how to attach silverlight event to ironpython function in dlr

Dino Viehland dinov at microsoft.com
Wed Aug 4 18:03:52 CEST 2010


Are you hosting the DLR/IronPython from C# code (vs. using something like Gestalt to just have plain old Python code)?  If so you’ll want to make sure the class is public.  You can then publish the class in a ScriptScope so that the Python code has access to it.  Or you can do ScriptRuntime.LoadAssembly so the Python code can import it and create an instance.  Once you’ve done that the context.OnClick += handler will work fine.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of ?
Sent: Wednesday, August 04, 2010 2:07 AM
To: Users at lists.ironpython.com
Subject: [IronPython] how to attach silverlight event to ironpython function in dlr

in dlr 1.0 i want to do something like this
in c# code behind
class Context
{
   public event EventHandler OnClick
   ///register this instance as a variable name "context" in ironpython
  ///...
}
in ironpython i want to do
def handler(sender, e):
      //.......

context.Onclick += handler
is it possible to do this in dynamic language runtime in silverlight?


________________________________
您想拥有和网易免费邮箱一样强大的软件吗?<http://qiye.163.com/?163>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100804/b7c86c90/attachment.html>


More information about the Ironpython-users mailing list