Silverlight 在使自动化树可访问方面做得很好,但有没有办法以编程方式要求屏幕阅读器阅读某些内容?到目前为止,我一直在使用:
AutomationPeer peer = FrameworkElementAutomationPeer.FromElement(element);
if (peer == null)
{
peer = FrameworkElementAutomationPeer.CreatePeerForElement(element);
}
if (peer != null)
{
peer.RaiseAutomationEvent(AutomationEvents.AutomationFocusChanged);
}
这在调试 Silverlight 运行时下工作正常(即,如果我从 VS 内部启动 IE),但如果我在 Visual Studio 之外启动 IE(即使它指向同一个内部开发服务器......),它也不起作用。那么有没有另一种简单的方法来让屏幕阅读器阅读一些东西呢?
编辑:它在 MS Narrator 中也可以正常工作,但在 NVDA 中不行……很奇怪。