+ Reply to Thread
Results 1 to 5 of 5

Thread: MapTips not working with MapApplication.Current.Map

  1. #1
    Michael Oberegger
    Join Date
    Oct 2011
    Posts
    6
    Points
    0
    Answers Provided
    0


    0

    Default MapTips not working with MapApplication.Current.Map

    I have run into an interesting problem where I am able to get MapTips working on a map that I create myself, but not on the map provided by the MapApplication.Current.Map reference.

    I created an AddIn (just a Command that opens up a new user control/window) that contains the code from the example provided at http://help.arcgis.com/en/webapi/sil...GraphicsMapTip, with a few changes. The control doesn't create it's own map, but uses the map provided from MapApplication.Current.Map. I use the same GraphicsLayer xaml code provided from the example, but just put it inside the user control's LayoutRoot resource list instead, and add the graphic layer to the application's map when the control loads with the MapApplication.Current.Map.Layers.Add method. Doing this, the geometries are showing up, but the MapTips won't display.

    As a test, what I did was create my own map within the user control, using the same map xaml code from the example. I added the graphic layer to this map instead of the one provided from the MapApplication, and the geometries display with the MapTips. The code is exactly the same, just referencing a different map. I actually have a sample now with two identical graphic layers, one assigned to each map, with copies of the graphic returned from the query added to each layer. In this example, MapTips display in my user control with my own map, but not on the viewer's map.

    Anyone know why this might be? Is there a step that I'm missing to get MapTips to display on the viewer's map? Any help is greatly appreciated.

    Thanks!

    Mike

  2. #2
    Michael Oberegger
    Join Date
    Oct 2011
    Posts
    6
    Points
    0
    Answers Provided
    0


    0

    Default Re: MapTips not working with MapApplication.Current.Map

    Alright, so I sort of figured out what the issue was. When using the map from the viewer, the MapTip has to be assigned directly to the Graphic, and not the GraphicLayer. Not sure why this is... when using my own map, I can add the MapTip to the Graphic itself, OR the GraphicLayer, and it will work in both cases. For some reason, when using the viewer's map, adding the MapTip to only the GraphicLayer is not sufficient, and needs to be added to each Graphic individually.

    I can work around this limitation (for lack of a better word), although I am still curious as to why this behavior exists. Feel free to add any thoughts on that, as I am very interested to hear them!

    Thanks for your time!

  3. #3
    Katherine Dalton

    Join Date
    Jan 2010
    Posts
    299
    Points
    173
    Answers Provided
    22


    0

    Default Re: MapTips not working with MapApplication.Current.Map

    Hi Mike,

    A couple options on this - 1) Override the default pop-up for a layer by specifying the pop-up template/header or 1) Disable popups on a layer programmatically (via LayerProperties.IsPopupEnabled) and then Set GraphicsLayer.MapTip. But yes, you are correct, as long as Pop-ups are enabled you cannot specify the MapTip for a GraphicsLayer.

    Katy
    Katy Dalton
    Esri Product Engineer

  4. #4
    Ryan Koehnen
    Join Date
    Apr 2010
    Posts
    30
    Points
    10
    Answers Provided
    1


    0

    Default Re: MapTips not working with MapApplication.Current.Map

    Quote Originally Posted by katydalton View Post
    Hi Mike,

    A couple options on this - 1) Override the default pop-up for a layer by specifying the pop-up template/header or 1) Disable popups on a layer programmatically (via LayerProperties.IsPopupEnabled) and then Set GraphicsLayer.MapTip. But yes, you are correct, as long as Pop-ups are enabled you cannot specify the MapTip for a GraphicsLayer.

    Katy
    Katy,

    Simple question- How do I get or set the LayerProperties object from a GraphicsLayer, or any other layer for that matter? Casting doesn't work, can't find a property or method, and it doesn't "look" like a dependency object, so I'm stuck at the moment.
    Ryan Koehnen GIS Analyst / Software Engineer
    ddms, inc.

  5. #5
    Ryan Koehnen
    Join Date
    Apr 2010
    Posts
    30
    Points
    10
    Answers Provided
    1


    0

    Default Re: MapTips not working with MapApplication.Current.Map

    Quote Originally Posted by koeh0017 View Post
    Katy,

    Simple question- How do I get or set the LayerProperties object from a GraphicsLayer, or any other layer for that matter? Casting doesn't work, can't find a property or method, and it doesn't "look" like a dependency object, so I'm stuck at the moment.
    Nevermind, I figured this out, LayerProperties is a static class... (duh!) ;-)
    Ryan Koehnen GIS Analyst / Software Engineer
    ddms, inc.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts