0

I try 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 ?

0

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.