我将URL
中的图片插入到RichEditBox
中,如此:
// Create a MemoryStream from uri, and insert into richeditbox
System.IO.Stream stream = await new HttpClient().GetStreamAsync("some url");
var memoryStream = new MemoryStream();
await stream.CopyToAsync(memoryStream);
memoryStream.Position = 0;
this.richEditBox.Document.Selection.InsertImage(40, 40, 0, Windows.UI.Text.VerticalCharacterAlignment.Baseline, "image", memoryStream.AsRandomAccessStream());
哪种方法正常,但按backspace
时我无法删除(使用屏幕键盘)图像!
有人有什么想法吗?
答案 0 :(得分:0)
Selection.StartPosition
this.richEditBox.Document.Selection.StartPosition--;
this.richEditBox.Document.Selection.Delete(Windows.UI.Text.TextRangeUnit.Object, 1);
默认情况下 StartPosition
设置为EndPosition
Document.Selection
,因此尝试删除只是无所事事(因为没有选择)
注意:覆盖KeyDown
的{{1}}事件并将上述内容添加到RichEditBox
按键,以便从屏幕键盘获得所需的结果!