sharee.bike-App/LastenradBayern/TINK/View/Bike/BikeViewCellTemplateSelector.cs

26 lines
709 B
C#
Raw Normal View History

2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
namespace TINK.View.Bike
{
2022-09-06 16:08:19 +02:00
/// <summary>
/// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes).
/// </summary>
public class BikeViewCellTemplateSelector : DataTemplateSelector
{
DataTemplate bCBike;
DataTemplate iLockIBike;
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
public BikeViewCellTemplateSelector()
{
bCBike = new DataTemplate(typeof(BCBike));
iLockIBike = new DataTemplate(typeof(ILockItBike));
}
2021-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
=> item is TINK.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel ||
item is TINK.ViewModel.Bikes.Bike.CopriLock.BikeViewModel
? iLockIBike
: bCBike;
}
2021-11-07 19:42:59 +01:00
}