我的RichTextBox
中有一个文本,我想检查是否有任何单词不是黑色的。如果没有,那么我想要颜色值。
这是我尝试阅读每个单词的方法,但是我不知道该怎么做才能获得颜色。
Regex regex = new Regex(@"\b[\s,\.-:;]*");
string richText = new TextRange(RichTextBoxData.Document.ContentStart, RichTextBoxData.Document.ContentEnd).Text;
List<string> listofWords = regex.Split(richText).Where(x => !string.IsNullOrEmpty(x)).ToList();
//TextRange textRange = new TextRange(RichTextBoxData.Document.ContentStart, RichTextBoxData.Document.ContentEnd);
if (!String.IsNullOrEmpty(richText))
{
foreach (string words in listofWords)
{
//Check colour
}
}