Here is my XAML code:
<Grid>
<Grid.InputBindings>
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding MouseDblClick}" />
</Grid.InputBindings>
</Grid>
and my code-behind:
private RelayCommand _MouseDoubleClick;
public ICommand MouseDblClick
{
get
{
if (_MouseDoubleClick == null)
{
_MouseDoubleClick = new RelayCommand(param => Clicked());
}
return _MouseDoubleClick;
}
}
private void Clicked()
{
MessageBox.Show("Works");
}
I want the messageBox to show after I double click the grid. But nothing happens. Where's the mistake?