我正在使用 UIAutomation 做一些工作,需要在 WPF 中获取 AvalonEdit 控件的内容。我只能将 AvalonEdit 控件作为文本的 ControlType 来获取:
var editors = app.FindAll(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.Text));
不支持这个...
var targetTextPattern = editor[0].GetCurrentPattern( TextPattern.Pattern) as TextPattern;
我似乎找不到从中提取文本内容的方法,使用 ControlType.Text 时不可能吗?我也尝试过使用 ControlType Edit & Document 但 AvalonEdit 似乎不支持它们。
任何帮助都将不胜感激。谢谢!