2014-11-24 43 views

回答

1

我一直在使用白色一段時間,我知道這是非常晚,但我有同樣的問題。我已經使用文本模式從富文本框中獲取值,找到下面的示例代碼,希望這有助於反正。

AutomationElement ele =window.GetElement(SearchCriteria.ByAutomationId("richTextBoxId>")); 

     if (ele != null) 
     { 
      TextPattern txtPattern = ele.GetCurrentPattern(TextPattern.Pattern) as TextPattern; 
      String controlText = txtPattern.DocumentRange.GetText(-1); 
      Debug.WriteLine("the text is" + controlText); 

     }