using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ShareeBike.Model.Bikes.BikeInfoNS.BluetoothLock; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace ShareeBike.View.Bike { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class ILockItBike : ViewCell { public ILockItBike() { InitializeComponent(); } protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (Device.RuntimePlatform != Device.iOS) // Update of size is only required for iOS. return; var viewModel = BindingContext as ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel; if (viewModel == null) return; viewModel.PropertyChanged += (sender, e) => { if (e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BC.RequestHandler.Base.IsButtonVisible) || e.PropertyName == nameof(ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible)) { // Force update of view cell on iOS. // https://hausource.visualstudio.com/ShareeBike/_workitems/edit/132 ForceUpdateSize(); } }; } } }