The first time users select an image and press Delete deletes only the fields and not the image.
Workaround: Attach to CommandExecuting and CommandExecuted events of RadRichTextBox and ensure the image is deleted using the following code:
private void radRichTextBox_CommandExecuted(object sender, CommandExecutedEventArgs e)
{
if (e.Command is DeleteCommand && imageToDelete!=null)
{
this.radRichTextBox.Document.Selection.Clear();
this.radRichTextBox.Document.Selection.AddDocumentElementToSelection(imageToDelete);
this.radRichTextBox.Delete(true);
this.imageToDelete = null;
}
}
private ImageInline imageToDelete;
void radRichTextBox_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
{
if (e.Command is DeleteCommand)
{
var selectedBoxes = this.radRichTextBox.Document.Selection.GetSelectedBoxes().ToList();
if (selectedBoxes.Count() == 2 && selectedBoxes[0].AssociatedInline is FieldRangeStart && selectedBoxes[1].AssociatedInline is ImageInline)
{
imageToDelete = selectedBoxes[1].AssociatedInline as ImageInline;
}
}
}