WPF没有双击事件

//WPF模拟双击事件
int i = 0;
private void button1_Click(object sender, RoutedEventArgs e)
{
    i += 1;
    System.Timers.Timer t = new System.Timers.Timer(600);
    t.Interval = 600;
         
    t.Elapsed += (s, ee) => { t.Enabled = false; i = 0; };
    t.Enabled = true;
    if (i % 2 == 0)
    {
         t.Enabled = false;
         MessageBox.Show("双击");
         i = 0;
     }
}

你可能感兴趣的:(WPF)