c# - Xamarin Maps in MVVM -
hi not know got wrong can me? can not display map
view
<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" xmlns:local="clr-namespace:testapp;assembly=testapp" x:class="testapp.mappageview"> <contentpage.content> <local:custommap text="{binding custommap}" maptype="street" widthrequest="{x:static local:app.screenwidth}" heightrequest="{x:static local:app.screenheight}" />
view xaml.cs
public partial class mappageview : extendedcontentpage { public mappageview() { initializecomponent(); bindingcontext = new mapviewmodel(navigation); }
model
public class custommap : map { public list<position> shapecoordinates { get; set; } public custommap() { shapecoordinates = new list<position>(); } }
viewmodel
public class mapviewmodel : baseviewmodel { public custommap custommap { set; get; } public mapviewmodel(inavigation navigation) : base(navigation) { initializemapsposition(); } private void initializemapsposition() { custommap.shapecoordinates.add(new position(52.198913,21.025649)); custommap.shapecoordinates.add(new position(52.185499, 21.025425)); custommap.shapecoordinates.add(new position(52.189570, 21.057992)); custommap.shapecoordinates.add(new position(52.213227, 21.043427)); custommap.movetoregion(mapspan.fromcenterandradius(new position(52.237244, 21.025585), distance.fromkilometers(5.0))); }
position 9:21. cannot assign property "text": property not exists, or not assignable, or mismatching type between value , property
Comments
Post a Comment