0
我在我的ListBoxItem的樣式中使用MouseBindings。ListBoxItem偷鼠標單擊列表框
<MouseBinding MouseAction="LeftClick" Command="{Binding
DataContext.ViewWorkingImprovementAssetCommand}" CommandParameter="{Binding}"/>
具體來說,我使用LeftClick命令來激發視圖模型中的命令。問題是該項目沒有在列表框中被選中,因爲鼠標事件沒有進入列表框。那麼有沒有辦法將事件傳遞給父控件(ListBox)?
如果我在SelectionChanged的ListBox上使用交互觸發器,但可以重新點擊已經選擇的項目不會像名稱所示那樣觸發事件,我可以讓這件事情起作用。而當我的名單隻有一個問題的項目。
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ViewWorkingImprovementAssetCommand}"
CommandParameter="{Binding ElementName=RemovedImprovementAssetsListBox, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
任何想法?
我認爲,我們需要看到的XAML – Phil 2012-03-29 19:08:07
正確回答自己的問題,接受的答案拍攝,答案並不在問題的歸屬。 – 2012-04-12 23:07:15