新建一个按钮:
Button btn = new Button();
btn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, btn));
通过委托方式(c#):
public MainWindow()
{
InitializeComponent();
kinectButton.Click += new RoutedEventHandler(kinectButton_Clicked);
}
.......................
private void kinectButton_Clicked(object sender, RoutedEventArgs e)
{
hoveredButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent, hoveredButton));
}