AutomationElement.TryGetCurrentPattern(AutomationPattern, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves an object that implements a control pattern.
public:
bool TryGetCurrentPattern(System::Windows::Automation::AutomationPattern ^ pattern, [Runtime::InteropServices::Out] System::Object ^ % patternObject);
public bool TryGetCurrentPattern (System.Windows.Automation.AutomationPattern pattern, out object patternObject);
member this.TryGetCurrentPattern : System.Windows.Automation.AutomationPattern * obj -> bool
Public Function TryGetCurrentPattern (pattern As AutomationPattern, ByRef patternObject As Object) As Boolean
Parameters
- pattern
- AutomationPattern
The identifier of the control pattern to retrieve.
- patternObject
- Object
On return, the control pattern if it is supported; otherwise null
.
Returns
true
if the pattern is supported; otherwise false
.
Examples
The following example shows how to use this method to retrieve a control pattern.
// element is an AutomationElement.
object objPattern;
SelectionPattern selPattern;
if (true == element.TryGetCurrentPattern(SelectionPattern.Pattern, out objPattern))
{
selPattern = objPattern as SelectionPattern;
}
' element is an AutomationElement.
Dim objPattern As Object = Nothing
Dim selPattern As SelectionPattern
If True = element.TryGetCurrentPattern(SelectionPattern.Pattern, objPattern) Then
selPattern = DirectCast(objPattern, SelectionPattern)
End If
Remarks
For some forms of user interface (UI), this method will incur cross-process performance overhead. Applications can concentrate overhead by caching patterns and then retrieving them by using GetCachedPattern.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기