The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

Drag and Drop in Richeditbox RRS feed

  • Question

  • Hi Sir,

    How drag and drop an image in richeditbox in UWP. 

    Also I use following code to paste image in richeditbox. The cursor moves down to show that image is pasted but image is invisible. 

     var dataPackageView = Clipboard.GetContent();
                if (dataPackageView.Contains(StandardDataFormats.Bitmap))
                    IRandomAccessStreamReference imageReceived = null;
                        imageReceived = await dataPackageView.GetBitmapAsync();
                    { }
                    if (imageReceived != null)
                        var bitmapImage = new BitmapImage();
                        using (var imageStream = await imageReceived.OpenReadAsync())
                            rebMainEditor.Document.Selection.InsertImage((int)bitmapImage.PixelWidth, (int)bitmapImage.PixelHeight, 0, Windows.UI.Text.VerticalCharacterAlignment.Baseline, "Image", imageStream);

    Wednesday, October 23, 2019 2:38 PM

All replies

  • Hi,

    There are many thing might causes the problem. We should check both the source data and how it displays. First, when you get the stream from clipboard and convert it to a bitmapimage object, have you tried to directly show it in an Image control? Will the image show?

    Then when you are trying to insert the image, what about set the Width and Height directly to a specific value like 64? Will the image shows?

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, October 24, 2019 10:12 AM
  • I tried all the possible methods but do not work.

    what works is:


    Wednesday, October 30, 2019 3:21 AM
  • Hi,

    It's a good new to find a solution for this. Having a nice day.

    Best regards,


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Friday, November 1, 2019 3:30 AM