Hi,
I have found the solution of my Issue.
Sharing the code here, hope, it may help someone.
using System;
using System.Diagnostics;
using Esri.ArcGISRuntime.Geometry;
using Xamarin.Forms;
using Esri.ArcGISRuntime.Xamarin.Forms;
using Esri.ArcGISRuntime.Data;
using Esri.ArcGISRuntime.Mapping;
using Esri.ArcGISRuntime.Mapping.Popups;
using Esri.ArcGISRuntime.UI;
namespace GitTrial_Sample
{
public partial class IndexMapPage : ContentPage
{
public IndexMapPage()
{
InitializeComponent();
Title = "Show callout";
Initialize();
}
private void Initialize()
{
// Create a new basemap using the streets base layer
Basemap myBasemap = Basemap.CreateStreets();
// Create a new map based on the streets basemap
Map myMap = new Map(myBasemap);
// Assign the map to the MapView
MyMapView.Map = myMap;
// Wire up the MapView GeoVewTapped event
MyMapView.GeoViewTapped += MyMapView_GeoViewTapped;
}
private void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
// Get the user-tapped location
MapPoint mapLocation = e.Location;
// Project the user-tapped map point location to a geometry
Geometry myGeometry = GeometryEngine.Project(mapLocation, SpatialReferences.Wgs84);
// Convert to geometry to a traditional Lat/Long map point
MapPoint projectedLocation = (MapPoint)myGeometry;
// Format the display callout string based upon the projected map point (example: "Lat: 100.123, Long: 100.234")
string mapLocationDescription = string.Format("Lat: {0:F3} Long:{1:F3}", projectedLocation.Y, projectedLocation.X);
// Create a new callout definition using the formatted string
CalloutDefinition myCalloutDefinition = new CalloutDefinition("Location:", mapLocationDescription);
//myCalloutDefinition.DetailText = "This is Detailed text";
myCalloutDefinition.Text = "Header Line Text";
RuntimeImage rtImg = new RuntimeImage(new Uri("https://cdn0.iconfinder.com/data/icons/business-finance-vol-14-2/512/69-128.png"));
// Here URI can be any location of the image. I just referred randomly this img.
rtImg.LoadAsync();
//myCalloutDefinition.Icon = rtImg;
myCalloutDefinition.ButtonImage = rtImg;
Action<object> infoWindowButtonClick_Process = infoWindowBtn_Click_Event;
myCalloutDefinition.OnButtonClick = infoWindowButtonClick_Process;
// Display the callout
MyMapView.ShowCalloutAt(mapLocation, myCalloutDefinition);
}
private async void infoWindowBtn_Click_Event(object message)
{
Debug.Print("Info window Button Clicked......");
//var selectedAction = await DisplayActionSheet("Came from Infor Window", "OK", null, "You Clicked on Info window Button"); // This also Working
await DisplayAlert("Y=Infor window button clicked", "You came from Info Window on Map","OK"); // This also working
}
}
}
------- XAML File-------
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:esri="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.UI;assembly=Esri.ArcGISRuntime"
xmlns:local="clr-namespace:GitTrial_Sample" x:Class="GitTrial_Sample.IndexMapPage"
Title="Welcome to Index Map Page">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness" iOS="0,40,0,0" />
</ContentPage.Padding>
<esri:MapView x:Name="MyMapView">
</esri:MapView>
</ContentPage>
... I prefer to share full code, so that there is no confusion for newbies to free it.
find the is the sc
reenshot..