void editor_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e) { if (e.Command is InsertFieldCommand && e.CommandParameter is MergeField) { string fieldName = (e.CommandParameter as MergeField).PropertyPath; if ((e.CommandParameter as MergeField).PropertyPath.ToUpper() == "RECIPIENTPHOTO") { e.Cancel = true; MergeField mf = new MergeField(); mf.PropertyPath = fieldName; IncludePictureField picField = new IncludePictureField(); picField.SetPropertyValue(IncludePictureField.ImageUriProperty, mf); this.editor.InsertField(picField); } } }
private void InsertPictureField_Click(object sender, RoutedEventArgs e) { MergeField mergeField = new MergeField(); mergeField.PropertyPath = "RecipientPhoto"; IncludePictureField pictureField = new IncludePictureField(); pictureField.SetPropertyValue(IncludePictureField.ImageUriProperty, mergeField); this.radRichTextBox.InsertField(pictureField); }