silverlight模拟单击事件
public static class ButtonBaseExtensions
{
/// <summary>
/// 模拟单击事件
/// </summary>
/// <param name="button"></param>
public static void PerformClick(this System.Windows.Controls.HyperlinkButton button)
{
System.Windows.Automation.Peers.HyperlinkButtonAutomationPeer buttonPeer = new System.Windows.Automation.Peers.HyperlinkButtonAutomationPeer(button);
System.Windows.Automation.Provider.IInvokeProvider invokeProvider = buttonPeer.GetPattern(System.Windows.Automation.Peers.PatternInterface.Invoke) as System.Windows.Automation.Provider.IInvokeProvider;
invokeProvider.Invoke();
}
}