<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>
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; }
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.