sharee.bike-App/LastenradBayern/TINK/View/Bike/ILockItBike.xaml.cs

44 lines
1.4 KiB
C#
Raw Permalink Normal View History

2021-11-07 19:42:59 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TINK.Model.Bikes.Bike.BluetoothLock;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace TINK.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 TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel;
if (viewModel == null)
return;
viewModel.PropertyChanged += (sender, e) =>
{
if (e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BC.RequestHandler.Base<IBikeInfoMutable>.IsButtonVisible)
|| e.PropertyName == nameof(TINK.ViewModel.Bikes.Bike.BluetoothLock.RequestHandler.Base.IsLockitButtonVisible))
{
// Force update of view cell on iOS.
// https://hausource.visualstudio.com/TINK/_workitems/edit/132
ForceUpdateSize();
}
};
}
}
}