sharee.bike-App/LastenradBayern/TINK/View/MiniSurvey/Question/QuestionViewCellTemplateSelector.cs

27 lines
706 B
C#
Raw Normal View History

2021-11-07 19:42:59 +01:00
using Xamarin.Forms;
namespace TINK.View.MiniSurvey.Question
{
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-11-07 19:42:59 +01:00
2022-09-06 16:08:19 +02:00
public QuestionViewCellTemplateSelector()
{
checkOneViewCell = new DataTemplate(typeof(CheckOneViewCell));
freeTextViewCell = new DataTemplate(typeof(FreeTextViewCell));
}
2021-11-07 19:42:59 +01: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-11-07 19:42:59 +01:00
}