Events in overlay popups

3141
8
Jump to solution
11-10-2014 09:35 AM
TonyGeorges1
New Contributor III

Hi,

I'm trying to catch events into overlay popups and MapView always catch it before my overlay.

Did someone experience the same issue ?

Best regards,

Tony

0 Kudos
1 Solution

Accepted Solutions
AnttiKajanus1
Regular Contributor II

You should be able to do something like this (store / phone)

<esri:MapView.Overlays>

     <esri:OverlayItemsControl>

        <Grid x:Name="overlay" esri:MapView.ViewOverlayAnchor="{Binding}"

            Width="400" Height="400">

            <Button Content="Click me!"

                Tapped="Button_Tapped"

            ></Button>

        </Grid>

    </esri:OverlayItemsControl>

</esri:MapView.Overlays>

private void Button_Tapped(object sender, TappedRoutedEventArgs e)

{

    // stuff

    e.Handled = true;

}

Could you describe what events you are using and which platform?

View solution in original post

8 Replies
AnttiKajanus1
Regular Contributor II

You should be able to do something like this (store / phone)

<esri:MapView.Overlays>

     <esri:OverlayItemsControl>

        <Grid x:Name="overlay" esri:MapView.ViewOverlayAnchor="{Binding}"

            Width="400" Height="400">

            <Button Content="Click me!"

                Tapped="Button_Tapped"

            ></Button>

        </Grid>

    </esri:OverlayItemsControl>

</esri:MapView.Overlays>

private void Button_Tapped(object sender, TappedRoutedEventArgs e)

{

    // stuff

    e.Handled = true;

}

Could you describe what events you are using and which platform?

TonyGeorges1
New Contributor III

Thank you Antti it works !

  1. private void Button_Tapped(object sender, TappedRoutedEventArgs e) 
  2.     // stuff 
  3.     e.Handled = true

I supposed the event is not handled naturally because overlay visual tree is outside the visual tree of the map view ?

Tony

0 Kudos
AnttiKajanus1
Regular Contributor II

We aren't doing anything special concerning event bubbling so Tapped is bubbled all the way if it's not marked handled and eventually hits the MapView.

0 Kudos
deleted-user-Ohz6rwd1kavx
New Contributor III

We have a Windows Store + ArcGIS Runtime 10.2.6 app. We have a UserControl which we're displaying as an MapView overlay popup. Based on the info in this thread, we have solved the 'click through' issue we were seeing with the Button Tapped event passing through to the MapView...

... but we have been unable to prevent the MapView from zooming when end user drags the popup window while holding down their mouse/finger. We have checked to see which UIElement events are triggered, and then handled these... but none seem to do the trick. The MapView still pans when the user moves the popup. We want to allow the user to move the popup without panning the map.

How can we fix this? Any pointers in the right direction (puns intended)?

Could the anchor point somehow be involved here? Does the action of the user 'moving the popup' somehow 'move the map with it' because the anchor is being respected?@

Thx,

-Cory

0 Kudos
AnttiKajanus1
Regular Contributor II

Hi Cory,

If you want explicitly control about the mapview navigation, here is a pointer

Just disable interaction when needed and activate after the task is done.

Hope that helps.

0 Kudos
HuyHo
by
Occasional Contributor

I am dealing with a similar issue.  My Overlay is a hyperlink and I cannot get it to activate when touching it.  I cannot get the RequestNavigate event to fire.  Taking the border and put it out outside of the MapView, it works fine...

      <esri:MapView.Overlays>
        <esri:OverlayItemsControl>
          <Border x:Name="MapOverlay" Visibility="Collapsed" Background="Beige" Padding="12"
                  VerticalAlignment="Top" HorizontalAlignment="Right" BorderBrush="Black" BorderThickness="2">
              <TextBlock FontSize="20" FontWeight="Bold">
                <Hyperlink NavigateUri="http://www.esri.com" RequestNavigate="Hyperlink_RequestNavigate">
                  Go to Esri.com
                </Hyperlink>
              </TextBlock>
          </Border>
        </esri:OverlayItemsControl>
      </esri:MapView.Overlays>
0 Kudos
deleted-user-Ohz6rwd1kavx
New Contributor III

did you do this inside your Hyperlink_RequestNavigate?

e.Handled = true

re: my question about moving/dragging the overlay. the more I consider it, that may just be how overlays work. not sure.

In Windows Store, I do see that these events fire when I drag the overlay: PointerPressed, PointerRelease. I might be able to handle these events and create a new anchor point for the overlay where on PointerRelease... I didn't try that... but I suspect that the map will pan underneath, even if I do this.

0 Kudos
HuyHo
by
Occasional Contributor

Yes, I do.  But the event never fires.  I cannot tap on the hyperlink to activate the RequestNavigate event when it is inside a MapOverlay.

    private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
    {
      Output("Hyperlink RequestNavigate");
      Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
      e.Handled = true;
    }
0 Kudos