如何对RichEditBox
控件中的选定文字应用斜体格式?
我尝试使用此代码但不起作用。
private void SetItalic(object sender, RoutedEventArgs e)
{
var selection = ContentTxt.Document.Selection;
// doesn't work
selection.CharacterFormat.Italic = FormatEffect.On;
// this also doesn't work
selection.FormattedText.CharacterFormat.Italic = FormatEffect.On;
}
答案 0 :(得分:0)
将FontFamily="Segoe UI"
添加到RichEditBox XAML定义中。默认字体集是“Segoe WP”,显然不支持斜体。