Send mouse click on button in silverlight 2

Silverlight has a control button. Can I send a mouse click event programmatically?

+3
source share
6 answers

If you still want to do this. Now you can upgrade to Silverlight version 3.0 or later and do the following:

You can use the button automation pool from System.Windows.Automation.Peers to accomplish what you want.

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

    IInvokeProvider ip = (IInvokeProvider)peer;
    ip.Invoke();
}
+12
source

Click , - , . , Click, Click.

+1

.Net - P/Invoke SendInput() user32.dll, .Net.

Silverlight, , .Net, , , .

0

CRUD , . Datagrid. - click "Read", CRUD

:

    private void btnSave_Click(object sender, RoutedEventArgs e)
    {
  //.....Save Operation

      //--At Finish refresh the datagrid
      btnRead_Click(btnRead, new RoutedEventArgs());
    }
0

I have not used Silverlight, but I assume that this is the same process as Windows.Forms and WebControls. You just need to call the method .Click(Object o, EventArgs e).

-3
source

Source: https://habr.com/ru/post/1698080/


All Articles