Grant Limberg
Grant Limberg

Reputation: 21383

IInvokeProvider namespace?

Just for kicks I'm playing around a bit with C# and WPF. I'm going through some examples on sending a button click event to a button programmatically since Button.PerformClick() is no longer present. The example I'm following is using the IInvokeProvider from the System.Windows.Automation.Provider namespace. My copy of VisualStudio 2008 Pro can't seem to find said namespace, or the IInvokeProvider interface ANYWHERE! I've looked in the MSDN Documentation, and this is the correct namesapce, and it says it's available on Windows XP and above. What am I doing wrong?

I started the project as a C# WPF Windows Application using the .NET Framework version 3.5.

Upvotes: 4

Views: 3835

Answers (2)

reyou
reyou

Reputation:

Try this:

ButtonAutomationPeer bap = new ButtonAutomationPeer(myButton); IInvokeProvider iip = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider; iip.Invoke(); // This clicks the Button

Upvotes: 0

Jim H.
Jim H.

Reputation: 5579

Add a reference to UIAutomationProvider.dll... That should allow you to use the System.Windows.Automation.Provider namespace.

Upvotes: 10

Related Questions