Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

can we customize the height and width of map callout in xmarin.forms

here is the formatted String which i am binding to callout but i am able to see only some contents of my string in callout

private async void WebMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
try
{
WebMapView.DismissCallout();
MapPoint mapLocation = null;
var layers = await WebMapView.IdentifyLayersAsync(e.Position, 20, false);
if (layers.Count > 0)
{
foreach (var idResults in layers)
{
FeatureLayer idLayer = idResults.LayerContent as FeatureLayer;

                    await idLayer.LoadAsync();


                    var result = layers.First();
                    var feature = result.GeoElements.First() as ArcGISFeature;
                    await feature.LoadAsync(); // Load feature to get all attributes
                    Feature idFeature = result.GeoElements.First() as Feature;
                    featureAttrs = idFeature.Attributes;

                    var stateExtent = idFeature.Geometry;

                    Graphicoverlay = new GraphicsOverlay();
                    Graphic graphicLine = null;

                    graphicLine = new Graphic(stateExtent, AppConstant.HighLight1);
                    Graphicoverlay.Graphics.Add(graphicLine);

                    EnvelopeBuilder myEnvelopeBuilder = new EnvelopeBuilder(SpatialReferences.WebMercator);
                    //Geometry abd = oneGraphic.Geometry;
                    myEnvelopeBuilder.UnionOf(graphicLine.Geometry.Extent);
                    myEnvelopeBuilder.Expand(1.3);

                    mapLocation = myEnvelopeBuilder.Center;

                    Geometry myGeometry = GeometryEngine.Project(mapLocation, SpatialReferences.WebMercator);
                    MapPoint projectedLocation = (MapPoint)myGeometry;
                    string formattedString = "";
                    if (featureAttrs.Count > 0)
                    {
                        foreach (var attributes in featureAttrs)
                        {
                            string recordOneAttribute = $"{attributes.Key}  {attributes.Value}";
                            formattedString = $"{formattedString}\n{ recordOneAttribute}";
                        }
                    }
                    CalloutDefinition calloutDef = new CalloutDefinition("Feature:",formattedString);


                    WebMapView.ShowCalloutAt(mapLocation, calloutDef);

                }

            }
        }
        catch (Exception ex)
        {

            throw;
        }
    }
Tagged:
Sign In or Register to comment.