Select to view content in your preferred language

MapTip not working while using a Custom Marker Symbol

539
1
08-20-2010 04:24 AM
surjithu
New Contributor
Hi All,

In my application when using a Custom Marker Symbol the map tip is not working in Graphic Layer, its showing the graphic correctly but map tips are not displayed. When changing it to a normal symbol the map tips are working properly

This Custom Symbol is used to display data and and a symbol on the graphic, is there any alternate way to that

I'm getting data from a web service, creating and binding the graphic through code

If I use any built in symbols the map tips are working fine

Here is the code for Custom Marker Symbol

  public class ClusterSymbol : ESRI.ArcGIS.Client.Symbols.MarkerSymbol
  {
    public ClusterSymbol()
    {
      string template = "<ControlTemplate " +
      #if SILVERLIGHT
      "xmlns=\"http://schemas.microsoft.com/client/2007\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" +
      #else
   "xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" +
      #endif

       @" xmlns:esri=""clr-namespace:ESRI.ArcGIS.Client.ValueConverters;assembly=ESRI.ArcGIS.Client"">
      <Grid IsHitTestVisible=""False"">
        <Grid.Resources>" +
        #if SILVERLIGHT
         "<esri:DictionaryConverter x:Name=\"MyDictionaryConverter\" />" +
        #else
       "<esri:DictionaryConverter x:Key=\"MyDictionaryConverter\" />" +
        #endif
        @"</Grid.Resources>
      <Ellipse
       Fill=""{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Color, Mode=OneWay}""
       Width=""{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Size, Mode=OneWay}""
       Height=""{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Size, Mode=OneWay}"" />

      <Grid HorizontalAlignment=""Center"" VerticalAlignment=""Center"">
      <TextBlock
     Text=""{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Count, Mode=OneWay}""
     FontSize=""9"" Margin=""1,1,0,0"" FontWeight=""Bold""
     Foreground=""#99000000"" />
     
        <TextBlock
     Text=""{Binding Path=Attributes, Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Count, Mode=OneWay}""
     FontSize=""9"" Margin=""0,0,1,1"" FontWeight=""Bold""
     Foreground=""White"" />
      </Grid>
     </Grid>
      </ControlTemplate>";
      #if SILVERLIGHT
            this.ControlTemplate = System.Windows.Markup.XamlReader.Load(template) as ControlTemplate;
      #else
      MemoryStream templateStream = new MemoryStream(UTF8Encoding.Default.GetBytes(template));
      ControlTemplate = System.Windows.Markup.XamlReader.Load(templateStream) as ControlTemplate;
      #endif
    }

    public double Size { get; set; }

    public override double OffsetX
    {
      get
      {
        return Size / 2;
      }
      set
      {
        throw new NotSupportedException();
      }
    }
    public override double OffsetY
    {
      get
      {
        return Size / 2;
      }
      set
      {
        throw new NotSupportedException();
      }
    }
  }

Thanks,
Surjith
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor
Because of this: IsHitTestVisible="False"

If you disable hit testing, there's no way for the maptip to know you entered the feature with your mouse.
0 Kudos