Select to view content in your preferred language

Toolkit MapTip vs. GraphicsLayer MapTip

660
6
03-23-2011 07:42 AM
KeithGanzenmuller
Frequent Contributor
Probably a silly question but I am looking for an answer anyway.
What is the relationship between a MapTip from the toolkit that I drag into my map vs. the MapTip I define as part of my GraphicsLayer?
I have been using the GraphicsLayer.MapTip fairly successfully but now I want to determine somethings like when the MapTip is visible and what its actual size is.
Are there events off of the GraphicsLayer.MapTip like there are off the ToolKit.MapTip?
Rookie question I realize.

If it helps I can add the code of my MapTip that I use successfully now.

<esri:FeatureLayer  ID="Capital Improvements" OutFields="*"
                               Url="http://sql2k5/ArcGIS/rest/services/CIP/FeatureServer/0"
                               x:Name="CIP"
                               Visible="True"
                                MouseEnter="CIP_MouseEnter"
                                MouseLeave="CIP_MouseLeave" >
                <esri:FeatureLayer.Clusterer>
                    <esri:FlareClusterer MaximumFlareCount="20" FlareBackground="Blue" FlareForeground="White"  Radius="10">
                        </esri:FlareClusterer>
                </esri:FeatureLayer.Clusterer>
                <esri:GraphicsLayer.MapTip>
                    <Grid esri:GraphicsLayer.MapTipHideDelay="00:00:1.0">
                    <Border Background="Bisque" BorderBrush="BurlyWood" BorderThickness="5" >
                        <StackPanel Orientation="Vertical">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="Project Number: "
                                           FontSize="9" />
                                <TextBlock FontWeight="Bold"
                                           FontSize="9"
                                           Text="{Binding [ProjectNumber]}" />                               
                            </StackPanel>
                            <StackPanel Orientation="Vertical" >
                                <TextBlock Text="Project Name: "
                                           FontSize="9" />
                                <TextBlock FontWeight="Bold"
                                           FontSize="9"
                                           Text="{Binding [ProjectName]}" TextWrapping="Wrap" Width="250"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical">
                               
                                <TextBlock Text="Project Description: "
                                           FontSize="9" />
                                <ScrollViewer  VerticalScrollBarVisibility="Auto"
                                                   Width="275"
                                                   Height="100">
                                <TextBlock FontWeight="Bold"
                                           FontSize="9"
                                               Text="{Binding [ProjectNotes]}"
                                               TextWrapping="Wrap"
                                               Width="250"
                                                   />
                                </ScrollViewer>
                                    <Border BorderThickness="2"
                                            BorderBrush="BurlyWood"
                                            CornerRadius="10"
                                            Cursor="IBeam"
                                            Margin="2,5,2,2"
                                            VerticalAlignment="Center"
                                            HorizontalAlignment="Center">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,1"
                                                                 StartPoint="0.5,0">
                                                <GradientStop Color="BurlyWood"
                                                              Offset="1" />
                                                <GradientStop Color="SaddleBrown" />
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <HyperlinkButton Content="More Information"
                                                         TargetName="_blank"
                                                         NavigateUri="http://www.salina-ks.gov/filestorage/126/198/2521/7204/06-1579_South_Ninth_Street_Phase_IV.pdf"
                                                         HorizontalAlignment="Center"
                                                         FontSize="12"
                                                         FontFamily="Comic Sans MS"
                                                         FontWeight="Bold"
                                                         Foreground="#FF552E11"
                                                         Margin="0,2" />
                                    </Border>
                                    <HyperlinkButton />
                                </StackPanel>
                           

                        </StackPanel>
                    </Border>
                    </Grid>
                </esri:GraphicsLayer.MapTip>


            </esri:FeatureLayer>

Thanks
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
There's not really much difference. The Toolkit.MapTip has an extra feature where it expanded/collapses, but you could fairly easily do that in the GraphicsLayer maptip too.
Take a look of this custom control used in a maptip that determines when it is visibile or not:
http://www.arcgis.com/home/item.html?id=9329a4d26e314828926c71549e8b6803

Basically it's just a custom control assigned to the graphiclayer.maptip. It uses it's SizeChanged event to detect visibility.
0 Kudos
KeithGanzenmuller
Frequent Contributor
Thanks for the fast response.
I'm looking at the link you gave me.
You also mentioned I should be able to do the SizeChanged off the GraphicsLayer.MapTip easily.
How would I do that?

Thanks,
Keith
0 Kudos
JenniferNery
Esri Regular Contributor
You can add SizeChanged event on the MapTip.FrameworkElement (in your case, this is the Grid that contains the Border). This event will fire every time the map tip opens.
0 Kudos
KeithGanzenmuller
Frequent Contributor
That's perfect.
Thanks again for everyone's help.
0 Kudos
KeithGanzenmuller
Frequent Contributor
Based on the code above, is there a way to change the maptip offsets dynamically in code?
0 Kudos
dotMorten_esri
Esri Notable Contributor
Use the attached property esri:GraphicsLayer.MapTipHorizontalOffset/VerticalOffset and set it on the maptip element instance.
ie
...
<esri:GraphicsLayer.MapTip>
<Border esri:GraphicsLayer.MapTipHorizontalOffset="100">
...
</Border>
</esri:GraphicsLayer.MapTip>
0 Kudos