Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

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

$
0
0

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;
        }
    }

Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>