C# 没有窗口模式的窗口。模式

C# 没有窗口模式的窗口。模式,c#,.net,automation,ui-automation,C#,.net,Automation,Ui Automation,我正在写一个自动化应用程序,我遇到了一个问题 我需要检查window(ControlType.window)是否为模态,并且afaikWindowPattern提供了此类信息,但当我列出支持的模式时,只有以下内容: ScrollPatternIdentifiers.Pattern WindowPatternIdentifiers.Pattern TransformPatternIdentifiers.Pattern 如何从windowpattern标识符获取WindowsPattern或IsM

我正在写一个自动化应用程序,我遇到了一个问题

我需要检查window(
ControlType.window
)是否为模态,并且afaik
WindowPattern
提供了此类信息,但当我列出支持的模式时,只有以下内容:

ScrollPatternIdentifiers.Pattern
WindowPatternIdentifiers.Pattern
TransformPatternIdentifiers.Pattern
如何从
windowpattern标识符
获取
WindowsPattern
IsModalProperty


有什么相似之处吗?非常感谢一些示例代码:)

element.GetCurrentPattern(WindowPattern.Pattern)返回什么?它会引发一个异常,即模式不可用。奇怪。你确定你在看同一个元素吗?一段代码也会有所帮助。根据文档,ControlType窗口的元素必须支持窗口模式: