public MapPage() { InitializeComponent(); _bindContext = BindingContext as MapPageModel; map.UiSettings.ZoomControlsEnabled = true; map.UiSettings.CompassEnabled = true; map.UiSettings.MyLocationButtonEnabled = true; }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (BindingContext is MapPageModel) { context = ((MapPageModel)BindingContext); (BindingContext as MapPageModel).PropertyChanged -= Handle_PropertyChanged; (BindingContext as MapPageModel).PropertyChanged += Handle_PropertyChanged; } }
public MapPage() { BindingContext = new MapPageModel(); InitializeComponent(); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); var context = BindingContext as TTab; if (context == null) { return; } Context = context; NavigationService = context.Navigation; if (context.ViewBindingContext == null || BindingContext != context.ViewBindingContext) //Init Viewmodels and attach with correspoding views { switch (context.View.ToString().Substring(context.View.ToString().LastIndexOf(".", StringComparison.CurrentCulture) + 1)) { case "MapTabPage": { var mapspage = new MapPageModel(); mapspage.Init(context.Customer); context.ViewBindingContext = mapspage; BindingContext = context.ViewBindingContext; BindingContextSet(); break; } case "ContactDetailTabPage": { context.ViewBindingContext = Context.Parent; BindingContext = Context.Parent; BindingContextSet(); break; } case "OrderListTabPage": { var order = new OrderListTabPageModel(); order.Init(context.Customer); context.ViewBindingContext = order; BindingContext = order; BindingContextSet(); break; } case "QuotationsTabPage": { var quote = new QuotationsPageModel(); quote.Init(context.Customer); context.ViewBindingContext = quote; BindingContext = quote; BindingContextSet(); break; } case "ContractListTabPage": { var contract = new ContractPageModel(); contract.Init(context.Customer); context.ViewBindingContext = contract; BindingContext = contract; BindingContextSet(); break; } } } }