popup is empty when using CalloutDefinition with a Graphic as param

479
5
09-14-2017 06:41 AM
MarcusHakansson
New Contributor II

I'm using IdentifyGraphicsOverlayAsync to get my results from an GraphicsOverlay when I "Tap".

The Graphic i get has Geometry and Attributes with three Keys and Values and I then use "CalloutDefinition" to display the values  in map and the Popup gets visible in the right location but its empty.

MyMapView.ShowCalloutAt( e.Location, myGraphic);

0 Kudos
5 Replies
JoeHershman
MVP Regular Contributor

You need to set the Text property on the CalloutDefinition.  It does not automatically read the Attributes and display

0 Kudos
MarcusHakansson
New Contributor II

Is there any way that I can display my Attributes with ShowCalloutAt as a Grid?

I was aiming for something like this:

0 Kudos
JoeHershman
MVP Regular Contributor

Well since that is a image I posted, yes it is possible.  But there is a lot behind how it is implemented.  It uses a custom view that has an items control bound to a collection built out from the PopupDefinition,  There is a ShowCalloutAt method that takes a UIElement as a parameter and what you see in the above image uses that method.  This was actually designed at 100.0 before the Callout feature was added to the API

0 Kudos
MarcusHakansson
New Contributor II

Ok, thank you now. I know a little bit more. I'm right know trying to make some changes to the ControlTemplate of the Callout-Class to achieve something like this but not entirely happy with the result so far. 

0 Kudos
dotMorten_esri
Esri Frequent Contributor

You will want to create a custom UserControl that can present the attributes of a graphic. Then create the user control and pass it into this overload, instead of using the Callout Definition:

https://developers.arcgis.com/net/latest/wpf/api-reference//html/M_Esri_ArcGISRuntime_UI_Controls_Ge...

0 Kudos