views:

180

answers:

1

Hi !

I want to bind the MouseDoubleClick (or PreviewMouseDoubleClick) to my custom Command defined in my custom WPF Control.

The problem is that it does not work.

...
<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>
A: 

There is no direct way of doing it. Check this post http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/da54880a-b11c-4d3b-995b-546055398997

Steven