Windows Phone Universal RichEditBox斜体格式

时间:2015-01-11 09:20:33

标签: c# windows-phone-8.1 win-universal-app

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

1 个答案:

答案 0 :(得分:0)

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