Does the RichTextBox control support pasting images from the clipboard? If not, will it in a future version? Also, if this isn't currently possible, what is the most seemless way to get images into the control - does it require saving the image to disk first?
4 Answers, 1 is accepted
0
hwsoderlund
Top achievements
Rank 1
answered on 08 Mar 2011, 09:55 AM
The only format supported by the Silverlight clipboard is plain text. This means that not even rich text can be pasted from, say, MS Word or a web page with the formatting retained. But this is a limitation in Silverlight and not in the Telerik RichTextBox. If you use the built-in "Insert Image" function in the RichTextBox, the images will be inserted inline in the xaml as base64-encoded strings.
0
Hello Rick,
Henrik is absolutely right - thanks for providing such an accurate answer, Henrik.
What I can add is that images can be inserted through a dialog, similar to the way images are embedded in MS Word. They can also be included in code, using ImageInline or an InlineUIContainer containing an Image. If you use ImageInline with an absolute URI for UriSource, you have to make sure that the URI is for a page with permissive cross-domain policy.
Copy/Paste of rich text and images inside RadRichTextBox is supported through an internal clipboard.
If you encounter any difficulties with your scenario, you can get back to us with some details on the problem.
Kind regards,
Iva
the Telerik team
Henrik is absolutely right - thanks for providing such an accurate answer, Henrik.
What I can add is that images can be inserted through a dialog, similar to the way images are embedded in MS Word. They can also be included in code, using ImageInline or an InlineUIContainer containing an Image. If you use ImageInline with an absolute URI for UriSource, you have to make sure that the URI is for a page with permissive cross-domain policy.
Copy/Paste of rich text and images inside RadRichTextBox is supported through an internal clipboard.
If you encounter any difficulties with your scenario, you can get back to us with some details on the problem.
Kind regards,
Iva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Samuel
Top achievements
Rank 1
answered on 05 Oct 2011, 07:57 PM
If you use the built-in "Insert Image" function in the RichTextBox, the
images will be inserted inline in the xaml as base64-encoded strings.
Can I please have a step by step explanation for this? If you have an example code that will be great.
Appreciate your help!
Can I please have a step by step explanation for this? If you have an example code that will be great.
Appreciate your help!
0
Hello Samuel,
You just have to use the RadRichTextBox.InsertImage(Stream imageStream, string extension) method, for example:
Best wishes,
Boby
the Telerik team
You just have to use the RadRichTextBox.InsertImage(Stream imageStream, string extension) method, for example:
OpenFileDialog ofd =
new
OpenFileDialog();
ofd.Filter =
"Image Files (*.bmp, *.jpg, *.jpeg, *.png)|*.bmp;*.jpg;*.jpeg;*.png"
;
if
(ofd.ShowDialog() ==
true
)
{
string
extension = ofd.File.Extension;
using
(Stream imageStream = ofd.File.OpenRead())
{
this
.AssociatedRichTextBox.InsertImage(imageStream, extension);
}
}
Best wishes,
Boby
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>