Targeted functionality: I would like to add a control to the edit overlay canvas on mouse up after moving a point on the map. The user should be able to click 1 of 2 buttons to either save or cancel the move.
Problem: I can get my usercontrol to appear on the edit overlay canvas. However, the buttons on the user control are not clickable and I cant seem to figure out what is stealing the click event and not allowing the click to get to the buttons.
Private Sub InitializeSaveCancelDialog()
SaveCancelDialog = New SaveOrCancelBox()
SaveCancelDialog.Name = "SaveCancelDialog"
End Sub
End Region
Region "Event Handlers"
Private Sub EditOverlayMapMouseUp(ByVal sender As Object, ByVal e As MapMouseUpInteractiveOverlayEventArgs)
If SaveCancelDialog Is Nothing Then InitializeSaveCancelDialog()
If Not SaveCancelDialog.IsDescendantOf(RoverMapProperties._CurrentMapInstance.EditOverlay.OverlayCanvas) Then
RoverMapProperties._CurrentMapInstance.EditOverlay.OverlayCanvas.Children.Add(SaveCancelDialog)
Canvas.SetLeft(SaveCancelDialog, e.InteractionArguments.ScreenX + 5)
Canvas.SetTop(SaveCancelDialog, e.InteractionArguments.ScreenY)
Canvas.SetZIndex(SaveCancelDialog, 999999999)
Else
Canvas.SetLeft(SaveCancelDialog, e.InteractionArguments.ScreenX + 5)
Canvas.SetTop(SaveCancelDialog, e.InteractionArguments.ScreenY)
Canvas.SetZIndex(SaveCancelDialog, 9999999)
End If
End Sub
I am unsure what you mean by adding my custom control under Map control but I tried a few things. I tried adding the control to the background overlay which caused the control not to appear even. I tried adding a new overlay to the wpfmaps overlays and using that as the container for the control but that did not work either.
We did some try about this problem, it looks if you are build a usercontrol, it cannot receive the click event.
I think we can try to solve that follow this way:
Create template to design the UI, inherit from MapTool class and add the customMapTool into MapTools. Our PanZoomBar is implemented follow this way.
Write a custom overlay for example MyEditInteractiveOverlay : EditInteractiveOverlay, then override some function like MouseClickCore, find the children control here and adjust whether it need to be clicked. But I hadn’t found a way to get the position of child control today, so I hadn’t created a sample to you.
Thanks for the update as I am sure its pushing me in the right direction.
I’ll stay posted for any further updates and notify if I figure something out on my end.