Select to view content in your preferred language

graphic tooltip?

3749
4
10-28-2010 10:15 AM
ShaningYu
Honored Contributor
Using Flex Builder, I can set a graphic tooltip like that:
   myGraphic.toolTip = "my tooltip";
In SL, I cannot find the tooltip property, but see graphic.MapTip.  Does anyone knows how to set a tooltip value for SL application?  Thanks.
0 Kudos
4 Replies
JMcNeil
Deactivated User
you could try looking it up in API Referrence under the ESRI.ArcGIS.Client.Toolkit namespace...then look for the  MapTip class, which is for the Graphics Layer MapTip control .

I've never done anything like this but it seems like it would be something like:

In XAML

 <esri:MapTip x:Name="MyMapTip" BorderBrush="Black" 
                BorderThickness="1" Title="Graphic Info" VerticalOffset="10" 
                HorizontalOffset="10" Background="White"/>


Then in you code behind maybe something easy like this:

MyMapTip.GraphicsLayer = graphicsLayer;


J. 😄
0 Kudos
ShaningYu
Honored Contributor
Thanks to both for your responses.  I did review and tried the code before, but not successful.  In my scenario, the tooltip is applied to a usercontrol tool.  In the usercontrol's xaml,
        <esri:Map x:Name="_Map" Background="White" Extent="-122.554, 37.615, -122.245, 37.884" >
            <esri:GraphicsLayer ID="MyGraphicsLayer">
        </esri:Map>
       ...
        <Canvas HorizontalAlignment="Left" VerticalAlignment="Top" >
            <esri:MapTip x:Name="MyMapTip"  BorderBrush="#99000000"
                BorderThickness="1" Title="State Info" VerticalOffset="10"
                HorizontalOffset="10" Background="#DDFFFFFF" />
        </Canvas>
In the C# file,
            GraphicsLayer graphicsLayer = _Map.Layers["MyGraphicsLayer"] as GraphicsLayer;
            MyMapTip.GraphicsLayer = graphicsLayer;
Also the usercontrol's _Map is set the same as the MainPage's MyMap
in MainPage.xaml.cs:
        myUserControl.SetMap(this.MyMap);
in the C# file, by:
        public void SetMap(Map TheMap);   {
            _Map = TheMap;
        }
Is there anything wrong in my coding?  Thanks.
0 Kudos
JenniferNery
Esri Regular Contributor
I think you have the same problem you've had as in your other posts where your map and UserControl are separate.  I have already suggested creating a DependencyProperty in your UserControl so that it can have its own map source that gets set in your MainPage when you create an instance of it. 

You need not duplicate the contents of your map in the MainPage to your UserControl - this approach will not work, because they will be dealing with two different maps.

Try to solve one problem at a time. You will see what works in one and learn from it. Good luck.
0 Kudos