This sample shows how to return and modify the contents of a webmap from ArcGIS Online that contains map notes with pop-ups. Map notes are represented by a client-side feature layer with MapTips that contain popup contents. In this sample, the style of the map tips container is modified.
Download Sample Application
< UserControl x:Class = " ArcGISWPFSDK.WebMapNotesPopups "
xmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation "
xmlns:x = " http://schemas.microsoft.com/winfx/2006/xaml "
xmlns:esri = " http://schemas.esri.com/arcgis/client/2009 " >
< Grid x:Name = " LayoutRoot " >
< Grid.Resources >
< LinearGradientBrush x:Key = " PanelGradient " EndPoint = " 0.5,1 " StartPoint = " 0.5,0 " >
< LinearGradientBrush.RelativeTransform >
< TransformGroup >
< ScaleTransform CenterY = " 0.5 " CenterX = " 0.5 " />
< SkewTransform CenterY = " 0.5 " CenterX = " 0.5 " />
< RotateTransform Angle = " 176 " CenterY = " 0.5 " CenterX = " 0.5 " />
< TranslateTransform />
</ TransformGroup >
</ LinearGradientBrush.RelativeTransform >
< GradientStop Color = " #FF145787 " Offset = " 0.16 " />
< GradientStop Color = " #FF3D7FAC " Offset = " 0.502 " />
< GradientStop Color = " #FF88C5EF " Offset = " 0.984 " />
</ LinearGradientBrush >
</ Grid.Resources >
</ Grid >
</ UserControl >
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using ESRI.ArcGIS.Client;
using ESRI.ArcGIS.Client.WebMap;
namespace ArcGISWPFSDK
{
public partial class WebMapNotesPopups : UserControl
{
public WebMapNotesPopups()
{
InitializeComponent();
Document webMap = new Document();
webMap.GetMapCompleted += webMap_GetMapCompleted;
webMap.GetMapAsync("2ccf901c5b414e5c98a346edb75e3c13" );
}
void webMap_GetMapCompleted(object sender, GetMapCompletedEventArgs e)
{
if (e.Error == null )
{
foreach (Layer layer in e.Map.Layers)
{
if (layer is GraphicsLayer)
{
GraphicsLayer glayer = layer as GraphicsLayer;
Border border = glayer.MapTip as Border;
if (border != null )
{
border.Background = LayoutRoot.Resources["PanelGradient" ] as Brush;
border.CornerRadius = new CornerRadius(4);
}
}
}
LayoutRoot.Children.Add(e.Map);
}
}
}
}
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media
Imports ESRI.ArcGIS.Client
Imports ESRI.ArcGIS.Client.WebMap
Namespace ArcGISWPFSDK
Partial Public Class WebMapNotesPopups
Inherits UserControl
Public Sub New ()
InitializeComponent()
Dim webMap As New Document()
AddHandler webMap.GetMapCompleted, AddressOf webMap_GetMapCompleted
webMap.GetMapAsync("2ccf901c5b414e5c98a346edb75e3c13" )
End Sub
Private Sub webMap_GetMapCompleted(sender As Object , e As GetMapCompletedEventArgs)
If e.[Error ] Is Nothing Then
For Each layer As Layer In e.Map.Layers
If TypeOf layer Is GraphicsLayer Then
Dim glayer As GraphicsLayer = TryCast(layer, GraphicsLayer)
Dim border As Border = TryCast(glayer.MapTip, Border)
If border IsNot Nothing Then
border.Background = TryCast(LayoutRoot.Resources("PanelGradient" ), Brush)
border.CornerRadius = New CornerRadius(4)
End If
End If
Next
LayoutRoot.Children.Add(e.Map)
End If
End Sub
End Class
End Namespace
5/16/2014