The MouseUp event is fired if the MouseDown event includes e.handled = True
This resolves the issue for me. However, I have another issue involving this UserControl but I'll put that in a separate post.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to create a small dot that the user can move around a map. I use a UserControl for the dot:
<UserControl
....
MouseDown="MeMouseDown"
MouseUp="MeMouseUp"
MouseMove="MeMouseMove"
<Ellipse
Fill="{Binding Path=FillColor}"
Height="{Binding Path=Diameter}"
Width="{Binding Path=Diameter}" >
</Ellipse>
</UserControl>
Considering just the MouseDown event, I have in code-behind:
Public Class Dot
Inherits UserControl
.....
Public Event MyMouseDown As RoutedEventHandler
.....
Private Sub MeMouseDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
RaiseEvent MyMouseDown(sender, e)
End Sub
The code that creates the dot is:
Private Sub DrawPoint(Colr As SolidColorBrush, Radius As Double)
Dim ADot As New Dot With {.FillColor = Colr, .Diameter = 2 * Radius}
....
End Sub
and finally, responding to the MouseDown event:
Private Sub MyMouseDown(sender As Object, e As MouseButtonEventArgs)
Debug.WriteLine("MyMouseDown")
End Sub
That Debug statement does not fire when I click on the dot and I don't know why.
The MouseUp event is fired if the MouseDown event includes e.handled = True
This resolves the issue for me. However, I have another issue involving this UserControl but I'll put that in a separate post.
Try moving MouseDown, or adding something like MouseDown="EllipseMouseDown" to <Ellipse>. Then you will be able to identify the clicks on ellipse and on User Control.