爲什麼不ListView.InputBindings
工作?ListView InputBinding MouseBinding不起作用
我以相同的方式實施Interaction.Triggers
,它工作得很好。
<ListView Name="listView1" ItemsSource="{Binding Cars}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseClick">
<i:InvokeCommandAction Command="{Binding ItemSelectCommand}" CommandParameter="{Binding ElementName=listView1,Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.InputBindings>
<MouseBinding Gesture="LeftClick" Command="{Binding ItemSelectCommand}" CommandParameter="{Binding ElementName=listView1,Path=SelectedItem}"/>
</ListView.InputBindings>
</ListView>
真的不想當@ Grx70在此答案的評論提到,在父定義的LeftClick
鼠標手勢使用額外assmebly是否應該沒有(System.Windows.Interactivity
爲Interaction.Triggers
)
是否可以在ListViewItem上使用InputBindings而不是ListView?只是一個想法。 – 2015-02-06 09:40:51