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-boun...@lists.ironpython.com [mailto:users-boun...@lists.ironpython.com] On Behalf Of ? Sent: Wednesday, August 04, 2010 2:07 AM To: Users@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>
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com