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

Michael Foord fuzzyman at voidspace.org.uk
Sat Apr 17 03:00:54 CEST 2010


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/




More information about the Ironpython-users mailing list