日期:2014-05-17  浏览次数:21127 次

|ZTCWPF| RichTextBox可以用FontWeightProperty取得粗体,FontStyleProperty取得斜体,那下划线是哪个属性 谢谢
var fontWeight = richTextBox.Selection.GetPropertyValue(RichTextBox.FontWeightProperty);
var fontStyle = richTextBox.Selection.GetPropertyValue(RichTextBox.FontStyleProperty);
那下划线怎么取得

谢谢
------解决方案--------------------
FontStyle里包含UnderLine,
你获取的var fontStyle = richTextBox.Selection.GetPropertyValue(RichTextBox.FontStyleProperty);包含下划线的,fontStyle.UnderLine

话说楼主注册了几个马甲啊- -
------解决方案--------------------
Font myFont=richTextBox.Selection.FontStyle;
这样就有了
myFont.UnderLine
------解决方案--------------------
bool hasUnderline = richTextBox.Selection.GetPropertyValue(Inline.TextDecorationsProperty) == TextDecorations.Underline;
------解决方案--------------------
UnderLine 下划线
Italic 斜体
Bold 粗体