using Xamarin.Forms; namespace TINK.View.MiniSurvey.Question { /// /// Selects different templates for different question types. /// public class QuestionViewCellTemplateSelector : DataTemplateSelector { DataTemplate checkOneViewCell; DataTemplate freeTextViewCell; public QuestionViewCellTemplateSelector() { checkOneViewCell = new DataTemplate(typeof(CheckOneViewCell)); freeTextViewCell = new DataTemplate(typeof(FreeTextViewCell)); } protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { return item is ViewModel.MiniSurvey.Question.FreeTextViewModel ? freeTextViewCell : checkOneViewCell; } } }