开发者

Does the FlowDocument contain any user text?

How can you tell if a FlowDocument contains any text that the user typed in or not?

I have an application that auto-commits changes for each screen. I want to know if the FlowDocument obtained from a RichTextBox contains any user input or if it is blank. I convert the FlowDocument to binary xaml and commit it to db. If the FlowDocument contains no user text then I do not want to add a new FlowDocument to the db.

I don't want to parse the xaml to check if开发者_JAVA百科 there is any user text.


The way to do this is:

var range = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd);
if (!range.IsEmpty)
{
    // commit changes
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜