I'm trying to use the asp.net rad editor inside silverlight because you dont have an html editor and silverlight radrichtextbox is not even close.
So, basically I have it working but I am experiencing some minor problems. First, I have the editor being displayed inside of a htmlplaceholder. The place holder is located on a radwindow.
<
telerik:RadWindow
x:Class
=
"Views.HtmlEmail"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"600"
d:DesignWidth
=
"800"
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"100"
></
RowDefinition
>
<
RowDefinition
Height
=
"400*"
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
telerik:RadHtmlPlaceholder
Visibility
=
"Visible"
SourceUrl
=
"http://localhost:52878/Editor.aspx"
Grid.Row
=
"1"
Name
=
"placeholder"
/>
<
telerik:RadButton
Content
=
"Button"
Height
=
"Auto"
HorizontalAlignment
=
"Left"
Margin
=
"146,34,0,0"
Name
=
"radButton1"
VerticalAlignment
=
"Top"
Width
=
"Auto"
Click
=
"radButton1_Click"
/>
</
Grid
>
</
telerik:RadWindow
>
So, it shows up. I can get and set the html using javascript, for example:
// Get the IFrame from the HtmlPresenter
HtmlElement iframe = (HtmlElement)this.placeholder.HtmlPresenter.Children[0];
// Set an ID to the IFrame so that can be used later when calling the javascript
iframe.SetAttribute("id", "myIFrame");
html = html.Replace("'",@"""");
html = html.Replace(Environment.NewLine, "");
// Code to be executed
string code = @"document.getElementById('myIFrame').contentWindow.test('" + html + "');";
HtmlPage.Window.Eval(code);
//asp.net inside body element
<
script id="javascript1" type="text/javascript">
function test(html) {
var editor = $find("<%=RadEditor1.ClientID%>");
editor.set_html(html);
}
</script>
So, everything works fine. However, two problems:
1. When you drag the radwindow around the html placeholder content disappears and only shows a white background. This goes away when you are done dragging the window then the content reappears.
2. The biggest problem is this one. When I minimize the radwindow to the docking surface and then remaximize the window the asp.net content resets itself and goes blank. Let me know if i'm doing something incorrectly.