There are numerous comments about MouseDoubleClick for a ListBox and ListView. Most are a bit complicated.
One that looks simple is MouseBinding.Gesture Property (System.Windows.Input). However, it is not clear if this would work for a ListBox, or how to implement it.
Is there an example of simple C#/WPF code for a MouseDoubleClick on a ListBox item? The MouseDoubleClick jumps to the C# code (similar to a Button_Click).
Simple C#/WPF code for a MouseDoubleClick on a ListBox item?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Jayraj ChhayaRank #304 · 8.2K reputationPosted Feb 23, 2024, 1:46 AM EST
Hi Clyde Eisenbeis,
You can utilize the ListBox's MouseDoubleClick event along with the ItemContainerGenerator.
private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { ListBoxItem item = (ListBoxItem)GetDependencyObjectFromVisualTree((DependencyObject)e.OriginalSource, typeof(ListBoxItem)); if (item != null) { // Handle double-click logic here } } } private DependencyObject GetDependencyObjectFromVisualTree(DependencyObject startObject, Type type) { DependencyObject parent = startObject; while (parent != null && parent.GetType() != type) { parent = VisualTreeHelper.GetParent(parent); } return parent; }