Metro App RichEditBox默认ForegroundColor

时间:2013-07-13 16:18:34

标签: c# windows-runtime winrt-xaml

WinRT RichEditBox ForegroundColor默认为Black

如何将其更改为自定义颜色?

这就是我试过的......

// Set default ForegroundColor
ITextCharacterFormat defaultCharacterFormat = 
    redBody.Document.GetDefaultCharacterFormat();

defaultCharacterFormat.ForegroundColor = Colors.Blue;

redBody.Document.SetDefaultCharacterFormat(defaultCharacterFormat);
redBody.Document.ApplyDisplayUpdates();

有关如何使其发挥作用的任何想法?

1 个答案:

答案 0 :(得分:1)

如果您使用的是XAML RichEditBox,那么Foreground属性应该对您有用,例如<RichEditBox Foreground="Violet" />