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

26 lines
832 B
C#
Raw Permalink Normal View History

2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
namespace TINK.View.Bike
{
/// <summary>
/// Selects different templates for different bike types (BordComputer bikes, iLockIt bikes).
/// </summary>
public class BikeViewCellTemplateSelector : DataTemplateSelector
{
DataTemplate bCBike;
DataTemplate iLockIBike;
public BikeViewCellTemplateSelector()
{
bCBike = new DataTemplate(typeof(BCBike));
iLockIBike = new DataTemplate(typeof(ILockItBike));
}
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
2022-04-25 22:15:15 +02:00
=> 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
}
}