Completed
Last Updated: 16 May 2019 13:51 by ADMIN
ADMIN
Martin Ivanov
Created on: 03 Apr 2017 10:24
Category: RichTextBox
Type: Bug Report
0
RichTextBox: Images are pasted empty when copied from MS Paint, MS Snipping Tool
In some cases when an image is copied from an external source and pasted in the rich text box, the image is not displayed. This is caused by the Clipboard.GetImage() method used internally by the control. 

To work this around, you can subscribe for the CommandExecuting event of RadRichTextBox and manually get the image from the clipboard.

private void Rtb_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)

{
	PasteCommand command = e.Command as PasteCommand;
	if (command != null && (Clipboard.GetData("DeviceIndependentBitmap") != null))
	{
		//Get the image stream from the clipboard.
		//You can check the following blog post for an approach which you can use to get the image properly:
		//https://www.thomaslevesque.com/2009/02/05/wpf-paste-an-image-from-the-clipboard/
		this.radRichTextBox.InsertImage(imageStream, "jpeg");
		e.Cancel = true;
	}
}	
1 comment
ADMIN
Peshito
Posted on: 16 May 2019 13:51
Fix will be available in LIB Version 2019.2.520 expected on Monday, May 20th.