Select to view content in your preferred language

Facing issue in displaying URLs in InfoWindow control

677
1
07-19-2012 01:41 AM
Srinivasa_Kondala_RaoVepa
Deactivated User
Hi,

We have an application to display features as Bubble Map on map and Bubble size will varies based on the number of associated features with bubble\graphic. Each feature is having Title and URL attributes and the number of titles & URLs are varying from one bubble to the other bubble based on the features associated with bubble. The requirement is to show maptips (as InfoWindow or Pop-ups) for each Bubble which will show list of TITLES as HYPERLINK and clicking on the hyperlink, system navigate to corresponding link\URL.

We have tried implementing Maptips through InfoWindow control provided by ArcGIS API for Silverlight. Even following the way given in the ESRI samples, we are not able to display Maptips with desired results and below is the key issue that we are facing...
???Even URL is added as 'Uri' object to graphics; still URL is appearing as normal string in InfoWindow."

We also tried alternative Approach using Hyperlink button as Item Template and no luck to display Maptips as required:

Appreciate any help in using InfoWindow control to display URLs

Thanks,
Srinivas
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
I can't seem to reproduce with the following sample code. In this sample, I am using GraphicsLayer, where FeatureLayer inherits from. I also use InfoWindow with HyperlinkButton with Content and NavigateUri pointed to the attribute that contains URL. I'm using Initialized event handler to add this link URL attribute to my graphic.

XAML-code:
  <Grid.Resources>
   <esri:SimpleMarkerSymbol x:Key="BlueMarkerSymbol"
          Color="Blue"
          Size="12"
          Style="Circle" />
   <DataTemplate x:Key="MyFeatureLayerInfoWindowTemplate">
    <HyperlinkButton Content="{Binding [linkURL]}"
         NavigateUri="{Binding [linkURL]}"
         TargetName="_blank"
         FontSize="12" />
   </DataTemplate>
  </Grid.Resources>
  <esri:Map x:Name="MyMap">
   <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
   <esri:GraphicsLayer  ID="MyLayer"
         Initialized="GraphicsLayer_Initialized"
         MouseLeftButtonUp="GraphicsLayer_MouseLeftButtonUp">
    <esri:Graphic Symbol="{StaticResource BlueMarkerSymbol}">
     <esri:MapPoint X="-140.9"
           Y="63.391">
      <esri:Geometry.SpatialReference>
       <esri:SpatialReference WKID="4326" />
      </esri:Geometry.SpatialReference>
     </esri:MapPoint>
    </esri:Graphic>
   </esri:GraphicsLayer>
  </esri:Map>
  <esri:InfoWindow x:Name="MyInfoWindow"
       Padding="2"
       CornerRadius="20"
       Background="LightSalmon"
       Map="{Binding ElementName=MyMap}"
       ContentTemplate="{StaticResource MyFeatureLayerInfoWindowTemplate}"
       MouseLeftButtonUp="MyInfoWindow_MouseLeftButtonUp" />
 </Grid>


Code-behind
  private void GraphicsLayer_Initialized(object sender, EventArgs e)
  {
   var l = sender as GraphicsLayer;
   foreach (var g in l.Graphics)
    g.Attributes["linkURL"] = new Uri("http://resources.arcgis.com/en/help/silverlight-api/samples/start.htm");
  }
  private void GraphicsLayer_MouseLeftButtonUp(object sender, GraphicMouseButtonEventArgs e)
  {
   MyInfoWindow.Anchor = MyMap.ScreenToMap(e.GetPosition(MyMap));
   MyInfoWindow.IsOpen = true;
   MyInfoWindow.Content = e.Graphic.Attributes;
  }
  
  private void MyInfoWindow_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  {
   MyInfoWindow.IsOpen = false;
  }
0 Kudos