c# - Maps in Xamarin Forms and MVVM architecture -
how can show maps in xamarin forms , mvvm architecture.how can create postion on map in modelview , show in pageview?
view
<?xml version="1.0" encoding="utf-8"?> <d:extendedcontentpage xmlns:d="clr-namespace:testapp;assembly=testapp" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:maps="clr-namespace:xamarin.forms.maps;assembly=xamarin.forms.maps" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:class="testapp.mappageview"> <contentpage.content> <stacklayout verticaloptions="startandexpand" padding="30"> <maps:map widthrequest="320" heightrequest="200" text="{binding mapmodel.mymap]" isshowinguser="true" maptype="hybrid"/> </stacklayout> </contentpage.content> </d:extendedcontentpage> modelview
public class mapviewmodel: baseviewmodel { private mapmodel _mapmodel = null; private mapmodel mapmodel { { return _mapmodel; } set { if (_mapmodel != value) { _mapmodel = value; onpropertychanged(); } } } public mapviewmodel(inavigation navigation) : base(navigation) { initializemapsposition(); } private void initializemapsposition() { } public override void removehandlers() { throw new notimplementedexception(); } } } model public class mapmodel { public string mymap { set; get; }
public mapmodel(string mymap) { mymap = mymap; } } }
Comments
Post a Comment