public QuestionContainerView(ISurveyItem item, View questionView, SurveyPageAppearance appearance) { var headerView = new QuestionHeaderView (item, appearance) { VerticalOptions = LayoutOptions.Start }; var inputStackLayout = new StackLayout () { Style = appearance.QuestionContainerLayoutStyle, Children = { StandardViews.CreateSeparator (appearance.ItemSeperatorStyle), questionView, StandardViews.CreateSeparator (appearance.ItemSeperatorStyle) } }; var stackLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Children = { headerView, inputStackLayout, } }; if (!String.IsNullOrWhiteSpace (item.Footnote)) { var footerView = new QuestionFooterView (item, appearance); stackLayout.Children.Add (footerView); } Content = stackLayout; }
public PageHeaderView(PageHeader header, SurveyPageAppearance appearance) { var stackLayout = new StackLayout { Style = appearance.PageHeaderContentLayoutStyle }; if (!String.IsNullOrEmpty (header.Caption)) { var captionLabel = new Label { Text = header.Caption, Style = appearance.PageHeaderCaptionLabelStyle }; stackLayout.Children.Add (captionLabel); } if (!String.IsNullOrEmpty (header.Text)) { var textLabel = new Label { Text = header.Text, Style = appearance.PageHeaderTextLabelStyle }; stackLayout.Children.Add (textLabel); } Content = new StackLayout { Style = appearance.PageHeaderLayoutStyle, Children = { stackLayout, StandardViews.CreateSeparator (appearance.PageHeaderSeperatorStyle) } }; }
public NumericEntryQuantityQuestionInputView(QuantityQuestion question, SurveyPageAppearance appearance) : base(appearance) { _question = question; var stackLayout = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Spacing = 10 }; _entry = BuildValueEntry (question); stackLayout.Children.Add (_entry); if (question.HasUnitOptions) { _picker = BuildUnitPicker (question); stackLayout.Children.Add (_picker); } SetUIFromResponse (); // set event handlers AFTER populating _question.PropertyChanged += Question_PropertyChanged; _entry.TextChanged += Entry_TextChanged; if (_picker != null) { _picker.PropertyChanged += Picker_PropertyChanged; } Content = stackLayout; }
public QuestionInputViewContainer(IQuestion question, View view, SurveyPageAppearance appearance) { view.HorizontalOptions = LayoutOptions.FillAndExpand; var errorLabel = new Label { Style = appearance.QuestionErrorLabelStyle, Text = String.Empty, IsVisible = false, HorizontalOptions = LayoutOptions.FillAndExpand }; question.PropertyChanged += (sender, e) => { if (e.PropertyName == "HasError") { if (question.HasError) { errorLabel.Text = question.ErrorMessage; errorLabel.IsVisible = true; } else { errorLabel.IsVisible = false; } } }; Content = new StackLayout { Orientation = StackOrientation.Vertical, Style = appearance.QuestionInputViewContainerLayoutStyle, Children = { view, errorLabel } }; }
public CustomRadioGroup(SurveyPageAppearance appearance) { _appearance = appearance; UnselectedSource = _appearance.UnselectedOptionImageSource; SelectedSource = _appearance.SelectedOptionImageSource; }
public FreeTextQuestionInputView(FreeTextQuestion question, SurveyPageAppearance appearance) : base(appearance) { var entry = new GBEntry (); entry.HorizontalOptions = LayoutOptions.FillAndExpand; entry.VerticalOptions = LayoutOptions.FillAndExpand; entry.Placeholder = question.Text; entry.BindingContext = question; entry.SetBinding (Entry.TextProperty, new Binding ("Response", BindingMode.TwoWay)); Content = entry; }
public DateQuestionInputView(DateQuestion question, SurveyPageAppearance appearance) : base(appearance) { var picker = new ExtendedDatePicker (); picker.HorizontalOptions = LayoutOptions.StartAndExpand; picker.VerticalOptions = LayoutOptions.CenterAndExpand; picker.PlaceholderText = question.Text; picker.BindingContext = question; picker.SetBinding (ExtendedDatePicker.ValueProperty, new Binding ("Response", BindingMode.TwoWay)); Content = picker; }
public PickerOptionQuestionInputView(OptionQuestion question, SurveyPageAppearance appearance) : base(appearance) { var picker = new OptionValuePicker (); picker.HorizontalOptions = LayoutOptions.StartAndExpand; picker.VerticalOptions = LayoutOptions.CenterAndExpand; picker.PlaceholderText = question.Text; picker.BindingContext = question; picker.ItemsSource = question.OptionValues; picker.SetBinding (OptionValuePicker.ValueProperty, new Binding ("SelectedOption", BindingMode.TwoWay)); Content = picker; }
public QuestionFooterView(ISurveyItem question, SurveyPageAppearance appearance) { Content = new StackLayout { Style = appearance.QuestionFooterLayoutStyle, Children = { new Label { Text = question.Footnote, VerticalOptions = LayoutOptions.Start, Style = appearance.QuestionFooterLabelStyle } } }; }
public RadioGroupOptionQuestionInputView(OptionQuestion question, SurveyPageAppearance appearance) : base(appearance) { var radioGroup = new CustomRadioGroup (appearance); radioGroup.HorizontalOptions = LayoutOptions.FillAndExpand; radioGroup.VerticalOptions = LayoutOptions.Fill; radioGroup.BindingContext = question; radioGroup.ItemsSource = question.OptionValues; radioGroup.SetBinding (RadioGroup.SelectedItemProperty, new Binding ("SelectedOption", BindingMode.TwoWay)); HeightRequest = -1; Content = radioGroup; }
public QuestionHeaderView(ISurveyItem question, SurveyPageAppearance appearance) { Content = new StackLayout { Style = appearance.QuestionHeaderLayoutStyle, Children = { new Label { Text = question.Caption, VerticalOptions = LayoutOptions.FillAndExpand, Style = appearance.QuestionHeaderLabelStyle } } }; }
public CheckboxBooleanQuestionInputView(BooleanQuestion question, SurveyPageAppearance appearance) : base(appearance) { var option = new ToggleOption (); option.HorizontalOptions = LayoutOptions.FillAndExpand; option.VerticalOptions = LayoutOptions.CenterAndExpand; option.UnselectedSource = appearance.UnselectedCheckboxImageSource; option.SelectedSource = appearance.SelectedCheckboxImageSource; option.BindingContext = question; option.SetBinding (Option.TextProperty, new Binding ("Text", BindingMode.OneWay)); option.SetBinding (Option.IsSelectedProperty, new Binding ("Response", BindingMode.TwoWay)); Content = option; }
public virtual Page CreatePageForItem(ISurveyItem item, SurveyPageAppearance appearance) { Page page = null; if (item is ISurveySubpage) { page = new StandardSurveySubpage (); } else if (item is ISurveyPage) { page = new StandardSurveyPage (); } if (page != null) { page.BindingContext = item; } return page; }
public SurveyPageItemsView(SurveyPageAppearance appearance) { _appearance = appearance; VerticalOptions = LayoutOptions.FillAndExpand; Style = appearance.PageItemsViewStyle; _stackLayout = new StackLayout { Style = appearance.PageItemsLayoutStyle }; var scrollView = new ScrollView (); scrollView.Content = _stackLayout; Content = scrollView; }
public SubpageGroupQuestionInputView(SubpageGroupQuestion question, SurveyPageAppearance appearance) : base(appearance) { _question = question; var stackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand }; var captionLabel = new Label { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center, Text = question.SummaryText }; question.PropertyChanged += (sender, e) => { if (e.PropertyName == "SummaryText") { captionLabel.Text = question.SummaryText; } }; stackLayout.Children.Add (captionLabel); var disclosureImage = new Image { Source = appearance.DisclosureImageSource, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.CenterAndExpand }; stackLayout.Children.Add (disclosureImage); Content = stackLayout; var tapGestureRecognizer = new TapGestureRecognizer (); tapGestureRecognizer.Tapped += (sender, e) => OnTapped (); GestureRecognizers.Add (tapGestureRecognizer); }
public virtual View CreateViewForItem(ISurveyItem item, SurveyPageAppearance appearance, bool wrapInContainer) { View view = null; if (item is DateQuestion) { view = new DateQuestionInputView ((DateQuestion)item, appearance); } else if (item is PickerOptionQuestion) { view = new PickerOptionQuestionInputView ((OptionQuestion)item, appearance); } else if (item is RadioOptionQuestion) { view = new RadioGroupOptionQuestionInputView ((OptionQuestion)item, appearance); } else if (item is NumericEntryQuantityQuestion) { view = new NumericEntryQuantityQuestionInputView ((QuantityQuestion)item, appearance); } else if (item is CheckboxBooleanQuestion) { view = new CheckboxBooleanQuestionInputView ((BooleanQuestion)item, appearance); } else if (item is InlineGroupQuestion) { view = new InlineGroupQuestionInputView ((InlineGroupQuestion)item, appearance); } else if (item is SubpageGroupQuestion) { view = new SubpageGroupQuestionInputView ((SubpageGroupQuestion)item, appearance); } else if (item is FreeTextQuestion) { view = new FreeTextQuestionInputView ((FreeTextQuestion)item, appearance); } else if (item is SliderQuantityQuestion) { view = new SliderQuantityQuestionInputView ((SliderQuantityQuestion)item, appearance); } else if (item is PageHeader) { view = new PageHeaderView ((PageHeader)item, appearance); } var question = item as IQuestion; if (question != null) { view = new QuestionInputViewContainer (question, view, appearance); } if (view != null && wrapInContainer) { view = new QuestionContainerView (item, view, appearance); } return view; }
public SliderQuantityQuestionInputView(SliderQuantityQuestion question, SurveyPageAppearance appearance) : base(appearance) { _question = question; var vStack = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill }; var valueStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill, IsVisible = false }; if (question.IsValueVisible) { _valueLabel = BuildValueLabel (question); valueStack.Children.Add (_valueLabel); valueStack.IsVisible = true; UpdateValueLabel (); } if (question.HasUnitOptions) { _picker = BuildUnitPicker (question); valueStack.Children.Add (_picker); valueStack.IsVisible = true; } var sliderStack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Fill }; _labelledSlider = new LabelledSlider { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center }; if (question.Labels != null && question.Labels.Any ()) { _labelledSlider.Labels.Items = question.Labels; } else { _labelledSlider.Labels.IsVisible = false; } sliderStack.Children.Add (_labelledSlider); vStack.Children.Add (valueStack); vStack.Children.Add (sliderStack); UpdateUI (); // set event handlers AFTER populating _question.PropertyChanged += Question_PropertyChanged; _labelledSlider.Slider.PropertyChanged += Slider_PropertyChanged; if (_picker != null) { _picker.PropertyChanged += Picker_PropertyChanged; } HeightRequest = -1; Content = vStack; }
public QuestionInputView(SurveyPageAppearance appearance) { this.Appearance = appearance; this.Style = appearance.QuestionInputViewStyle; }
protected QuantityQuestionInputView(SurveyPageAppearance appearance) : base(appearance) { }
protected virtual View BuildItem(ISurveyItem item, SurveyPageAppearance appearance) { var wrapInContainer = !(item is IStaticSurveyItem); return SurveyItemViewFactory.Default.CreateViewForItem (item, appearance, wrapInContainer); }