sharee.bike-App/LastenradBayern/ShareeBike/View/Bike/BikeViewCellTemplateSelector.cs
2024-04-09 12:53:23 +02:00

25 lines
727 B
C#

using Xamarin.Forms;
namespace ShareeBike.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)
=> item is ShareeBike.ViewModel.Bikes.Bike.BluetoothLock.BikeViewModel ||
item is ShareeBike.ViewModel.Bikes.Bike.CopriLock.BikeViewModel
? iLockIBike
: bCBike;
}
}