Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 0.64 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to fire a command on double-click listbox item using MVVM?
  2. <ListBox Name="SmallVideoPreviews" Grid.Column="1" MaxHeight="965"
  3.     ItemsSource="{Binding BrowseVideos}"
  4.     ItemTemplate="{StaticResource BrowseTemplate}">
  5.     <ListBox.InputBindings>
  6.         <KeyBinding Key="p"
  7.             Command="{Binding PlayVideoCommand}"
  8.             CommandParameter="{Binding ElementName=SmallVideoPreviews, Path=SelectedItem}"/>
  9.         <MouseBinding Gesture="LeftDoubleClick"
  10.             Command="{Binding PlayVideoCommand}"
  11.             CommandParameter="{Binding ElementName=SmallVideoPreviews, Path=SelectedItem}"/>
  12.     </ListBox.InputBindings>
  13. </ListBox>