Just for kicks. I play a little with C # and WPF. I will talk about some examples when sending a button click event to a button programmatically since Button.PerformClick () is no longer present. In the following example, I use IInvokeProvider from the System.Windows.Automation.Provider namespace. My copy of VisualStudio 2008 Pro does not seem to be able to find the specified namespace or IInvokeProvider interface anywhere! I looked at the MSDN documentation and this is the correct namesapce file and it says that it is available in Windows XP and above. What am I doing wrong?
I started the project as a WPF Windows C # application using the .NET Framework version 3.5.
Add a link to UIAutomationProvider.dll ... This should allow you to use the System.Windows.Automation.Provider namespace.
Try the following:
ButtonAutomationPeer bap = new ButtonAutomationPeer (myButton); IInvokeProvider iip = bap.GetPattern (PatternInterface.Invoke) as IInvokeProvider; iip.Invoke (); // This is a button click