Select to view content in your preferred language

Map Tips and info

1445
9
02-07-2011 08:04 AM
MeConfused
Emerging Contributor
I like that fact that MapTips can relay quick info back to the user on hover.  But what if I want to put a URL link in the maptip window and allow the user to navigate to a web site.
As is....As soon as I move off the graphic or feature the window dissapears...

Looking to put a link in the maptip and allow the user to navigate to a URL
Can I accomplish this with a MapTip or do I need to look elsewhere?
0 Kudos
9 Replies
MeConfused
Emerging Contributor
Think I found something....this example seems to let the user click the maptip and open it?

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MapTipWidget
0 Kudos
MeConfused
Emerging Contributor
Maybe not....I am confused because I dont see in the example where its specifying to stay open...I cant see any difference between that example and mine....why cant I click on mine?
I am setting the MapTips right in the Graphics later definition...

                    <esri:GraphicsLayer ID="MyGraphicsLayerBufferResults" 
                                        MouseEnter="imageBuffer_Mousehover" 
                                        MouseLeftButtonDown="GraphicsLayerBuffer_MouseLeftButtonDown" >
                        <esri:GraphicsLayer.MapTip>
                            <Border BorderBrush="DarkGray" Background="Azure" CornerRadius="3" BorderThickness="1" Padding="3">
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="URL LINK: " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                        <TextBlock Text="{Binding [URL]}" HorizontalAlignment="Left" VerticalAlignment="Center" />                                    
                                     </StackPanel>
                                </StackPanel>
                            </Border>
                        </esri:GraphicsLayer.MapTip>                    
                    </esri:GraphicsLayer>
0 Kudos
MeConfused
Emerging Contributor
Alright I modified my MapTips to work liek the example above....BUT i have one question....how can I get the result to not be in the grid format...I want to retain the formatting I had inthe old maptips dialog window...

Example I want to keep the formatted version like this....not in a grid with rows...
                        <esri:GraphicsLayer.MapTip>
                            <Border BorderBrush="DarkGray" Background="Azure" CornerRadius="3" BorderThickness="1" Padding="3">
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Officer:    " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                        <TextBlock Text="{Binding [Officer]}" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Distance: " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                        <TextBlock Text="{Binding [BUFFER_DISTANCE]}" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                        <TextBlock Text="  meters from parcel" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                    </StackPanel>
                            </Border>
                        </esri:GraphicsLayer.MapTip>
                    </esri:GraphicsLayer>


MY CURRENT CODE

xaml
<esri:GraphicsLayer ID="MyGraphicsLayerBufferResults" 
        MouseEnter="imageBuffer_Mousehover" 
        MouseLeftButtonDown="GraphicsLayerBuffer_MouseLeftButtonDown" >
</esri:GraphicsLayer>

<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" >
     <esri:MapTip x:Name="MyMapTip"  BorderBrush="#99000000" 
             BorderThickness="1" Title="{Binding [NAME]}" VerticalOffset="10" 
             HorizontalOffset="10" Background="#DDFFFFFF" />
</Canvas>


xaml.vb
        ' BIND THE ATTRIBUTES TO THE MAPTIP THAT IS CLICABLE AND EXPANDABLE IN THE MAP
        MyMapTip.GraphicsLayer = _resultsGraphicsLayer




Confused here...

1.  I have my first example working and getting the proper format I want but cant go into the map tip
2.  Following the ESRI example allows me to enter the MapTip but I cannot eliminate the rows adn grid feel...as seen in the first example

Thoughts?...
0 Kudos
MeConfused
Emerging Contributor
I cant seem to see where the rows and columns are being set and where to turn them off/replace them with a listbox (or similar)
I tried to do this (see below) but it tells me that:

Error: Type Map Tip does not support direct content

Can I even modify a MapTips format? Or is the Row and column feel the only way?

<Canvas HorizontalAlignment="Left" VerticalAlignment="Top" >
     <esri:MapTip x:Name="MyMapTip"  BorderBrush="#99000000" 
      BorderThickness="1" Title="{Binding [NAME]}" VerticalOffset="10" 
      HorizontalOffset="10" Background="#DDFFFFFF" >
           <Border BorderBrush="DarkGray" Background="Azure" CornerRadius="3" BorderThickness="1" Padding="3">
                 <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                           <TextBlock Text="Officer:    " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" />
                           <TextBlock Text="{Binding [Officer]}" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                       </StackPanel>
                 </StackPanel>
           </Border>
      </esri:MapTip>
</Canvas>
0 Kudos
JenniferNery
Esri Regular Contributor
Have you looked at this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple

You can try to modify the DataTemplate applied to the InfoWindow.

If you are using MapTip, you can set MapTipHideDelay as in this sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip. See how MapTip is set up for StatesGraphicsLayer, with the delay you are able to mouse hover on the MapTip. Compare this with the other layer's MapTip that immediately closes once you leave the feature.
0 Kudos
MeConfused
Emerging Contributor
Have you looked at this sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple

You can try to modify the DataTemplate applied to the InfoWindow.

If you are using MapTip, you can set MapTipHideDelay as in this sample http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip. See how MapTip is set up for StatesGraphicsLayer, with the delay you are able to mouse hover on the MapTip. Compare this with the other layer's MapTip that immediately closes once you leave the feature.



So do I have you understood correctly....

Data Template
If I want to modify how the results appear and to get rid of the rows and columns that are in a maptip I have to use a data Template of some sort.  This will allow me format how the data is displayed.

MapTip
I can delay the closing of a MapTip
Question: BUT will I be able to click a link of some sort
Question: and will the MapTip close when I MouseLeave
Question: Is there a way to format the MapTip like the Data Template?  Or are you stuck with the Rows and Columns in the MapTip

I just want to make sure that I am using teh right tool for the job...
I want to hover over a Selected Graphic from a query of some sort...a littel window opens displaying results, and image and a link to a website.
MapTip or Data Template?

Thanks Jennifer
0 Kudos
JenniferNery
Esri Regular Contributor
Yes, DataTemplates are used to specify the visual representation of your data.

Question: BUT will I be able to click a link of some sort

This will depend if you provided a hyperlink.

Question: and will the MapTip close when I MouseLeave

Yes, MapTip closes when you leave the graphic or enter another graphic. MapTipHideDelay, just delays closing the maptip.

Question: Is there a way to format the MapTip like the Data Template? Or are you stuck with the Rows and Columns

GraphicsLayer MapTips can also be a user-defined UserControl so it is customizable like the InfoWindow. You will be able to do something like:
MyGraphicsLayer.MapTip = new MyMapTipUserControl();

Toolkit MapTip widget style can be modified too and the approach is similar to this: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/05/20/Use-control-templates-to-customize...

I think the best way to decide is try out the SDK samples and customize them. These are your 3options.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#MapTipWidget
0 Kudos
MeConfused
Emerging Contributor
Thank you very much for explaining that Jennifer...I know it sounds like easy stuff to you....but confusing here...but very appreciated.

It seems that the MapTip with the delay will work for me...
The InfoWindow seems to require a click to close...I think I am seeing that correctly???  But I think I can change that to a MouseLeave right?????

THanks Again
0 Kudos
JenniferNery
Esri Regular Contributor
Sure no problem. If you will be using InfoWindow,       
MyInfoWindow.IsOpen = false;
is the code that closes the InfoWindow. You can set this anytime.
0 Kudos