0

我想将 MouseDoubleClick(或 PreviewMouseDoubleClick)绑定到我在自定义 WPF Control 中定义的自定义 Command

问题是它不起作用。

...
<Popup>
...
<!--This CommandBinding **DOES NOT WORK** !-->
<ListBox Grid.Row="1"
   x:Name="PART_lBox"                                                                      
   VirtualizingStackPanel.IsVirtualizing="True"
   DisplayMemberPath="{TemplateBinding DisplayMemberPath}"                                                                     
   ItemsSource="{TemplateBinding ItemsSource}">
 <ListBox.InputBindings>                                                                    
  <MouseBinding Command="{x:Static local:ListPicker.AcceptCommand}"                                                                                  
       MouseAction="LeftDoubleClick" />
 </ListBox.InputBindings>
</ListBox>

<!--This CommandBinding **WORKS** !-->
<Button Grid.Row="0"
  Grid.Column="1"                                                                        
  HorizontalAlignment="Right"
  Command="{x:Static local:ListPicker.AcceptCommand}"
  Content="Accept" />
...
</Popup>
4

1 回答 1

0

没有直接的方法可以做到这一点。检查这篇文章 http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/da54880a-b11c-4d3b-995b-546055398997

于 2010-08-21T08:46:50.260 回答