Button Click Event

Here is small code to trigger button’s Click event using automation peer from source code :

if (button is Button)
{
ButtonAutomationPeer peer = new ButtonAutomationPeer((Button)button);

IInvokeProvider ip = (IInvokeProvider)peer;
ip.Invoke();
}

Trick will be used in upcoming article “Smart shortcut keys” for adding accessibility to silverlight applications.

Leave a Reply

Discover more from Pixytech

Subscribe now to keep reading and get access to the full archive.

Continue reading