private void Bold_Click(object sender, RoutedEventArgs e) { ITextSelection selectedText = EventDescription.Document.Selection; if (selectedText != null) { selectedText.CharacterFormat.Bold = FormatEffect.Toggle; } EventDescription.Focus(FocusState.Programmatic); }
private void Underline_Click(object sender, RoutedEventArgs e) { ITextSelection selectedText = EventDescription.Document.Selection; if (selectedText != null) { ITextCharacterFormat charFormatting = selectedText.CharacterFormat; selectedText.CharacterFormat.Underline = (charFormatting.Underline == UnderlineType.None) ? UnderlineType.Single : UnderlineType.None; } EventDescription.Focus(FocusState.Programmatic); }