|
|
|
Programatically clicking a button in WPF
|
Location: Blogs Near Shore Blog |
|
| Posted by: admin |
7/22/2007 9:41 AM |
| Button, like many other WPF controls, has a peer class in the System.Windows.Automation.Peers namespace to support UI Automation: ButtonAutomationPeer. It can be used as follows with a Button called myButton:
ButtonAutomationPeer bap = new ButtonAutomationPeer(myButton);
IInvokeProvider iip = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
iip.Invoke(); // This clicks the Button
This is useful for automated testing and accessibility. |
|
| Permalink |
Trackback |
|
|
|
|