Is dragging and dropping an image into the RichTextBox supported?

2 posts, 0 answers
  1. Martin
    Martin avatar
    17 posts
    Member since:
    May 2014

    Posted 30 Jul 2014 Link to this post

    Is dragging and dropping an image into the RichTextBox supported? It doesn't work out-of-the-box and I've always tried the TelerikEditorDemo_WPF example without luck. Scenario: Dragging an image from the desktop and dropping it into the RichTextBox.
  2. Aylin
    Aylin avatar
    75 posts

    Posted 04 Aug 2014 Link to this post

    Hello Martin,

    Thank you for contacting us. 

    Image drag-and-drop is not supported out-of-the-box in RichTextBox but you could easily implement it using the Drop event handler. Here is an example implementation: 

    private void radRichTextBox_Drop(object sender, DragEventArgs e)
        string[] droppedFiles = e.Data.GetData(DataFormats.FileDrop) as string[];
        foreach (string droppedFile in droppedFiles)
            using (Stream imageStream = File.OpenRead(droppedFile))
                this.radRichTextBox.InsertImage(imageStream, Path.GetExtension(droppedFile));

    I hope this helps.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top