DasElias
DasElias

Reputation: 569

UWP - Add inline element in RichEditBox

Background: I'm looking for a solution to make images in a RichEditBox resizable by the user. The problem is that according to this question there is no API to do so. Nevertheless, in the comments was mentioned that the questioner should have a look on ImageCropper.

Unfortunately, I found no possibility to insert any UWP container into a RichEditBox, like it is possible with InlineUIContainer for RichEditBlock. Is there any possibility to embed an inline element in a RichEditBox?

Upvotes: 1

Views: 175

Answers (2)

dgellow
dgellow

Reputation: 832

Maybe to add some more context to this question, because I was looking for something similar. It is correct that UWP's RichEditBox does not support inline elements. But by default images are resizable, it is just very difficult to see it!

What I noticed is that when inserting an image with some transparency I could see some handles (small squares on the corners and sides) to resize it, and that does work, the user can resize by dragging them. The user experience isn't too great, the cursor does not make it clear at all that you can drag them, and that requires the user to first select the image by double clicking on it.

enter image description here

In this screenshot the image is selected, you can see the handles around it.

Unfortunately, when inserting a screenshot, or another image that doesn't have transparency around it, the handles are not visible. I guess they are drawn below the image? But if one can guess the handles location and target correctly (pretty hard to do), the image can be resized!

enter image description here

In this screenshot the image on the right is selected, but handles aren't visible. If the user click and drag a corner, the image can be resized...

Unfortunately I haven't yet found a way to customize the resizing behaviour.

Upvotes: 0

Nico Zhu
Nico Zhu

Reputation: 32775

Add inline element in RichEditBox

I'm afraid you can't insert inline element into RichEditBox. Currently UWP RichEditBox does not support add uielement. And for resizing image, we suggest you call InsertImage with different image size to replace current one.

Upvotes: 2

Related Questions