Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
XamMap mouseenter
posted

Hi,

I have a map where I'm showing data in the tooltip as you hover over a particular shape.

Unfortunately the tooltip disappears after a couple of seconds and it appears there's not much you can do about that.

So instead I've put a label on the page, and when the mouse enters a shape I want to put the text into the label instead, so it remains static (as long as the mouse is over the shape). When it moves to another shape, it should then show the required text from that shape, and so on.

I've added mouseenter and mouseleave events to my shape layer:

<ig:MapLayer x:Name="SectorLayer" Foreground="Black" IsClickable="False" IsSelectable="False" FillMode="None" FontSize="16" FontWeight="Bold" IsVisible="False" Opacity="0" Stroke="Black" StrokeThickness="2" MouseEnter="ShowMapToolTip" MouseLeave="ClearMapToolTip">

In my back end code at present I'm simply trying to put the tooltip text into the label just to show I can do it:

Private Sub ShowMapToolTip(sender As Object, e As System.Windows.Input.MouseEventArgs)
lbPostcodeInfo.Content = sender.ToolTip
End Sub

I'm aware the code is probably incorrect, but unfortunately my code never even gets run, it's not calling ShowMapToolTip at all when the mouse is moving over any of the shapes. Any idea what I'm doing wrong in terms of getting a postback to my code when the mouse entering or leaving a shape?

Parents
No Data
Reply
  • 2505
    Offline posted

    Hi dalereed,
    Are you trying to achieve an effect similar to the sample here?

    If this is the case, you could try attaching to XamMap's ElementHover event and then show the information you want like this (the sample code uses a ListBox control, named lstBox):
            private void XamMap_ElementHover(object sender, Infragistics.Controls.Maps.MapElementHoverEventArgs e)
            {
                lstBox.Items.Add(e.Element.Caption.ToString());
            }

    Hope that helps,
    Milana Zhileva

Children
No Data