How can I catch both single-click and double-click events on WPF FrameworkElement?

后端 未结 9 1489
鱼传尺愫
鱼传尺愫 2020-12-15 06:21

I can catch a single-click on a TextBlock like this:

private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
{
    MessageBo         


        
9条回答
  •  再見小時候
    2020-12-15 06:42

    You are simply can use MouseDown event and count click number, like this:

    if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
    {
        // your code here
    }
    

提交回复
热议问题