2014-04-04 59 views
0

我有一個帶有EventTrigger MouseDoubleClick的列表框。MVVMLIGHT:MouseDoubleClick不起作用

不起作用:事件名稱= 「MouseDoubleClick」

工作:事件名稱= 「的MouseLeftButtonUp」

這裏是查看

<ListBox x:Name="MyListBox" /> 
     <i:Interaction.Triggers> 
     <i:EventTrigger EventName="MouseDoubleClick"> 
     <command:EventToCommand Command="{Binding UserSelectionCommand}" 
           CommandParameter="{Binding SelectedItem, ElementName=MyListBox}" 
               /> 
     </i:EventTrigger> 
     </i:Interaction.Triggers> 

在視圖模型

public RelayCommand<string> UserSelectionCommand 
{get; private set;} 

UserSelectionCommand = new RelayCommand<string>(ShowSelectedItem); 

private void ShowSelectedItem(string selectedData) 
{ .. } 

回答

0

關閉ListBox應該在Interaction.Triggers之後,而不是之前。

<ListBox> 
<Interaction.Triggers> 
.. 
<Interaction.Triggers> 
</ListBox>