I have a ListView control in XAML.
The items are defined by a template control with a TextBlock inside a Grid.
Now I want to trigger an action when I double click the TextBlock.
To my surprise I find there is no DoubleClick event to hook up … !
I thought it was just the TextBlock that din’t have it, but actually no controls have it.
I look for DoubleClick and MouseDoubleClick but they are definitely absent.
I have read suggestions where an EventTrigger is added to a control with Gesture=”MouseDoubleClick”. It looks promising but in my case the compiler complains and tells me there is no such gesture as a MouseDoubleClick. Same with DoubleClick.
Did the DoubleClick disappear in some version of .Net?
I have .Net Framework 4.5 and the project is WPF Application.
Do I have to do stupid workarounds by detecting MouseDown and check the elapsed time since last MouseDown? Sounds like stoneage …
It is always refreshing to formulate your problem!
After thinking a while I thought maybe they added a counter to the mouse events instead of having separate events.
That seems to be the case!!!
The MouseButtonEventArgs has a ClickCount property. When checking for value 2 I detect my DoubleClick!
Still a bit odd though to just kick out the DoubleClick. Even after searching I find no reference as to when and why it disappeared.