WPF SL 获取RichTextBox 的内容(string)

WPF:

private string GetText(RichTextBox richTextBox) 
{
        TextRange textRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
        return textRange.Text;
}

SL:

var run = describeRichTextBox.Selection.Start.Parent as Run;
if (run != null)
 {
    string str = run.Text;
 }


   

你可能感兴趣的:(WPF SL 获取RichTextBox 的内容(string))