This xaml code attempts to implement a "mouse double click" for a ListBox "list of cities".
<ListBox x:Name="gLBxCities" Margin="10,0,10,10" Foreground="#0000FF" > <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}"> <TextBlock.InputBindings> <MouseBinding Gesture="MouseDoubleClick" Command="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.ItemSelectedCommand}"/> </TextBlock.InputBindings> </TextBlock> </DataTemplate> </ListBox.ItemTemplate>
I want a "mouse double click" on one ListBox "City" to execute the xaml.cs code -> similar to selecting a <Button>.
<Button>.
xaml
<Button x:Name="gBuCities" Content=" → " Margin="0,300,0,10" Click="gBuCities_Click" />
xaml.cs
private void gBuCities_Click(object sender, RoutedEventArgs e) { ... }
How do I implement a "mouse double click" for a ListBox "City"?