I try to create MapView without XAML but I can't. My code blocks in below

class ShowMap : ContentPage
    public ShowMap()
        Title = "Show a Map";

        Map myMap = new Map(Basemap.CreateImagery());
        MapView MyMapView = new MapView();
        MyMapView.Map = myMap;

        //Content = new StackLayout
        //    VerticalOptions = LayoutOptions.CenterAndExpand,
        //    HorizontalOptions = LayoutOptions.CenterAndExpand,
        //    Children =
        //    {
        //        MyMapView
        //    }


If I uncomment block in code. Shown an error.

cannot convert from 'Esri.ArcGISRuntime.UI.Controls.MapView' to 'Xamarin.Forms.View'

How can I do this?


This occurs because you are trying to use the 'native' MapView on Xamarin forms. Make sure that the MapView is type of Esri.ArcGISRuntime.Xamarin.Forms.MapView.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.