Introduction
Some classes like Button an MenuItem provided a property named Command which makes coding simplier, but most other classes do not provide same kind of functionality for each events.
I want to implement a Command for DoubleClick, I did tried Googled, there are some solution included using EventSetter or something like that, but it is too complicated for me, so I developed a new control just for doing that.
Background
The control is very simple...(96 lines), it is actually a DockPanel which you can used to host your control (which implement doubleclick).
Using the code
<Window x:Class="WPF_DirectoryLister_DMVVM.Window1"
xmlns:control="clr-namespace:QuickZip.Windows.Controls"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="600">
<Grid>
<control:TrapDoubleClick>
<Label control:TrapDoubleClick.Command="ApplicationCommands.Help">
DoubleClickMe
</Label>
</control:TrapDoubleClick>
</Grid>
</Window>
Points of Interest
Took me a while to figure out, if you want to override OnMouseLeftButtonDown method, you will have to set Control.AllowDrop to true.
History
04/02/08 Initial Release
Reference
DoubleClick on Framework Element