Windows Phone 通用 RichEditBox 斜体格式

Windows Phone Universal RichEditBox Italic Formatting

如何对 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;
    }

FontFamily="Segoe UI" 添加到您的 RichEditBox XAML 定义中。默认字体集是 "Segoe WP",显然不支持斜体。