ThinkGeo.com    |     Documentation    |     Premium Support

Adding Controls To Overlay

Hello,

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.

Here is the code that adds to the edit overlay:

 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

Thanks for any help!

Hi Mike,

I guess the problem is we have some other control above the edit overlay, so your custom control cannot accept the click event.

So my first suggestion is please try to add your custom control under Map control and see whether it can accept the click event.

Regards,

Don

Hi Don,

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.

Thanks!

Hi Mike,

We hadn’t met the same requirement, but I think we can help you to do some try to see how to implement that.

Most of our developer are focus on new release, so maybe we cannot reply you quickly, please wait our update about it.

Regards,

Don

Hi Don,

Just checking in for any updates.

Thanks!

Hi Mike,

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:

  1. Create template to design the UI, inherit from MapTool class and add the customMapTool into MapTools. Our PanZoomBar is implemented follow this way.

  2. 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.

Regards,

Don

Hi Don!

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.

Thank you,

Mike

Hi Mike,

I am glad to hear that’s helpful, if we have any further information about this, we will let you know also.

Regards,

Don