1 private void listBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) 2 { 3 var element = (FrameworkElement)sender; 4 if (e.ClickCount == 1) 5 { 6 var timer = new System.Timers.Timer(500); 7 timer.AutoReset = false; 8 timer.Elapsed += new ElapsedEventHandler((o, ex) => element.Dispatcher.Invoke(new Action(() => 9 { 10 var timer2 = (System.Timers.Timer)element.Tag; 11 timer2.Stop(); 12 timer2.Dispose(); 13 UIElement_Click(element, e); 14 }))); 15 timer.Start(); 16 element.Tag = timer; 17 } 18 if (e.ClickCount > 1) 19 { 20 var timer = element.Tag as System.Timers.Timer; 21 if (timer != null) 22 { 23 timer.Stop(); 24 timer.Dispose(); 25 UIElement_DoubleClick(sender, e); 26 } 27 } 28 } 29 30 private void UIElement_Click(object sender, MouseButtonEventArgs e) 31 { 32 33 } 34 35 private void UIElement_DoubleClick(object sender, MouseButtonEventArgs e) 36 { 37 38 }