Should I be using AutomationPeer or AutomationElement? Or both?
See the question and my original answer on StackOverflowYou don't have to implement anything to use a pattern. UI Automation does this for you (acting as a proxy for the target application). This is well explained in official documentation here: Get Supported UI Automation Control Patterns
Here is an example extract:
SelectionItemPattern pattern;
try
{
pattern = yourAutomationElement.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
}
catch (InvalidOperationException ex)
{
Console.WriteLine(ex.Message); // Most likely "Pattern not supported."
return;
}
pattern.Select();