I have a graphics layer that is generated dynamically based on mouse clicks. I would like to show a popup with the attribute info i've set in the graphic to be shown when clicked. The graphic is populated with the geometry from the mouse click and attributes will be based on the result from an ImageServiceIdentifyTask. I can get the popup to appear but it's blank. How do I get this to show the information?I'm using Draw to generate the graphic, code snippit-
drawObject = new Draw(MapApplication.Current.Map)
{
DrawMode = DrawMode.Point,
IsEnabled = true,
};
drawObject.DrawComplete += DrawObject_DrawComplete;
Then the popup is shown after the draw complete event is fired-private void DrawObject_DrawComplete(object sender, DrawEventArgs args)
{
MapPoint point = args.Geometry as MapPoint;
point.SpatialReference = MapApplication.Current.Map.SpatialReference;
Graphic graphic = new Graphic()
{
Geometry = point,
};
GraphicsLayer graphicsLayer = MapApplication.Current.Map.Layers["IdentifyResultsLayer"] as GraphicsLayer;
if (graphicsLayer == null)
{
graphicsLayer = createResultsLayer();
MapApplication.Current.Map.Layers.Add(graphicsLayer);
}
else
{
graphicsLayer.ClearGraphics();
}
//test attributes
graphic.Attributes.Add("ObstacleClearanceSurfaceHeight", 100);
graphic.Attributes.Add("GroundElevation", 150);
graphic.Attributes.Add("Difference", 333);
graphicsLayer.Graphics.Add(graphic);
MapApplication.Current.ShowPopup(graphic, graphicsLayer);
}