开发者

Is it possible to set a mouselistener in WPF?

Can i set a m开发者_C百科ouselistener (Clicked) in WPF?


Simple,

  • Just a Click attribute to your xaml control
  • Assign it a handler
  • Define the handler in your xaml.cs

In your xaml,

<Button Click="Button_Click"></Button>

In your xaml.cs,

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        //What should be done when you click the control
    }

There are loads of mouse events available. Check MSDN for the list of mouse events supported in WPF


If te user clicked where? If you have a button(or window or pretty much anything else) you simpy add the MouseDown() eventhandler....

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜