Telerik Rad Rich Text box can display Text embedded in HTML but not the Image.
<telerik:RadRichTextBox Grid.Row="7" x:Name="editor" Margin="24,55,22,13" Width="740" Height="200" IsSpellCheckingEnabled="True" AllowDrop="True" IsReadOnly="false">
<telerik:RadRichTextBox.Resources>
<telerikDocumentsHTML:HtmlDataProvider x:Key="HtmlProvider" RichTextBox="{Binding ElementName=editor}" Html="{Binding Body, Mode=TwoWay}" />
</telerik:RadRichTextBox.Resources>
</telerik:RadRichTextBox>
I am trying to implement the code mentioned above for Rad Rich TextBox. The textbox shows the text value emmbeded in the html. But the problem it cannot show if the html contains a image source. The HTML tried..... <table><tr><td>Test Image</td></tr><tr><td><img src="c:\\20519a.jpg" ></img></td></tr></table> Can the image be shown in Rad Rich text box?
6 Answers, 1 is accepted
Please note the source of the image -
c:\\20519a.jpg. This is a local file on your computer, and besides being unavailable anywhere else, it's outside the Silverlight security sandbox and therefore not rendered in RadRichTextBox. For images to be visible in RadRichTextBox when you load an HTML source file, they should be either embedded (base64 encoded) or with an URI either within the same domain as the Silverlight application or on a domain with a permissive cross-domain policy.
Let us know if we can assist you any further.
Greetings,
Ivailo
the Telerik team
RadRichTextBox for Silverlight/WPF is quite different from RadEditor for ASP.NET. It runs on the client and the images are inserted as instances of ImageInline. These elements are always embedded in the document, i.e. you cannot show an image in RadRichTextBox in any other way than embedding it in the document. The RichTextBox does not have an Html property like the ASP.NET editor and only exports its document on demand (using format or data providers).
You can preview our online demo and see how the InsertPictureCommand, which the button in RadRichTextBoxRibbonUI is bound to, works for inserting an image that the client chooses using the OpenFileDialog. There are also methods in RadRichTextBox's API for inserting Images (ImageInline inherits Inline - see here):
public
void
InsertImage(Stream imageStream,
string
extension)
public
void
InsertInline(Inline inline)
However, pasting images in Silverlight can only be done between two RadRichTextBoxes, as Silverlight's clipboard supports only plain text.
I hope this helps. Kind regards,
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I am working on an out-of-browser (with trusted level) silverlight app to display XHTML.
I have all the XHTML in "My Documents". In spite of that, the text box does not display images. I have the sample XHTML below.
"image/cover.jpg" is in a sub directory of the XHTML file
Thanks
Sri
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
>Sample Title</
title
>
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html; charset=UTF-8"
/>
<
link
href
=
"LD.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
</
head
>
<
body
style
=
"background-color: #000007; margin: 0.00em;"
>
<
div
id
=
"coverpage"
>
<
p
class
=
"center"
>Testing 1<
img
src
=
"image/cover.jpg"
height
=
"100%"
alt
=
"cover"
/> Testing 2</
p
>
</
div
>
<
p
class
=
"breakhere"
></
p
>
</
body
>
</
html
>
In out-of-browser mode, relative URIs are resolved using application's site of origin as base URI, so you have to have 'image/cover.jpg' published there. You can also choose to use images embedded directly in the HTML as base64-encoded strings.
All the best,
Boby
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I use RadRichTextBox for silverlight to insert image info for view,the data can be insert sccussful,but when I get the same data from MysqlDB for edit,the images can't be display, can you tell me why? help.
Flowing is test code :
IDocumentFormatProvider provider =
new
XamlFormatProvider();
using
(MemoryStream sStream =
new
MemoryStream())
{
provider.Export(radRichTextBox1.Document,sStream);
sStream.Seek(0,SeekOrigin.Begin);
radRichTextBox2.Document = provider.Import(sStream);
}
in the radRichTextBox1 contains image,but view in radRichTextBox2, not display image.
Thanks,
Wendy.