[IronPython] Still stuck on rich editor with IronPython and Silverlight

Jimmy Schementi Jimmy.Schementi at microsoft.com
Sat Apr 17 03:19:56 CEST 2010


Michael, let's get Dino in on this ...

Dino, This seems like our fault, but I'm not savvy enough to track it down or verify my claim. Seems like it doesn't work regardless of invoking via reflection or ref.emit code; calling it's constructor 10,000 times still gave the same result. As Michael said, doing anything with RichTextBox fails when invoked from IronPython, but works fine when invoked without IronPython on the stack (pure C# app, for example). I'm amazed that it fails when *called* from C#, meaning that IronPython is doing something to make statically compiled code fail. 

We can look at this together on Monday unless you get to it sooner; I thought I knew how to use windbg but failed miserably at doing anything useful, so you'll have to help :)

~Jimmy

On Apr 16, 2010, at 6:01 PM, "Michael Foord" <fuzzyman at voidspace.org.uk> wrote:

> Hello all,
> 
> I'm still stuck on using the Silverlight 4 RichTextBox from IronPython. Unfortunately this is blocking our project. :-(
> 
> Instantiating the RichTextBox directly or loading it from xaml fails.
> 
> A wrapper class in C# that instantiates the RichTextBox and returns it to IronPython fails.
> 
> A wrapper C# class that internally creates the RichTextBox but never returns it to IronPython *still* fails. Anyone got any suggestions for possible alternative approaches?
> 
> My latest (failing) attempt. C#:
> 
>   public static class Foo
>   {
>       static RichTextEditor _editor = null;
> 
>       public static void Create(StackPanel panel)
>       {
>           _editor = new RichTextEditor();
>           panel.Children.Add(_editor);
>       }
>   }
> 
> IronPython:
> 
> clr.AddReference('SilverlightTextEditor, Version=1.0.0.0, Culture=neutral')
> 
> canv = Canvas()
> xaml = Application.Current.LoadRootVisual(canv, "app.xaml")
> 
> from SilverlightTextEditor import Foo
> panel = StackPanel()
> xaml.Children.Add(panel)
> 
> Foo.Create(panel)
> 
> (Note that RichTextEditor is a standalone UserControl editor component built on top of the RichTextBox. It works fine from C#.)
> 
> All the best,
> 
> Michael Foord
> 
> -- 
> http://www.ironpythoninaction.com/
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> 




More information about the Ironpython-users mailing list