2021-08-01 17:24:15 +02:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
2024-04-09 12:53:23 +02:00
|
|
|
|
namespace ShareeBike.View.MiniSurvey.Question
|
2021-08-01 17:24:15 +02:00
|
|
|
|
{
|
2022-09-06 16:08:19 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Selects different templates for different question types.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class QuestionViewCellTemplateSelector : DataTemplateSelector
|
|
|
|
|
{
|
|
|
|
|
DataTemplate checkOneViewCell;
|
|
|
|
|
DataTemplate freeTextViewCell;
|
2021-08-01 17:24:15 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
public QuestionViewCellTemplateSelector()
|
|
|
|
|
{
|
|
|
|
|
checkOneViewCell = new DataTemplate(typeof(CheckOneViewCell));
|
|
|
|
|
freeTextViewCell = new DataTemplate(typeof(FreeTextViewCell));
|
|
|
|
|
}
|
2021-08-01 17:24:15 +02:00
|
|
|
|
|
2022-09-06 16:08:19 +02:00
|
|
|
|
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
|
|
|
|
|
{
|
|
|
|
|
return item is ViewModel.MiniSurvey.Question.FreeTextViewModel
|
|
|
|
|
? freeTextViewCell
|
|
|
|
|
: checkOneViewCell;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-01 17:24:15 +02:00
|
|
|
|
}
|