public void BindModel(SurveyEntryViewModel vm, SurveyQuestion model)
        {
            Log.Information("Cell manual bind");
            this.ContentView.ClearsContextBeforeDrawing = true;
            this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;

            AnswerSlider.SetThumbImage(UIImage.FromFile("SliderButton.png"), UIControlState.Normal);

            QuestionLabel.Text = model.Question;
            MinLabel.Text      = model.MinText;
            MaxLabel.Text      = model.MaxText;

            AnswerSlider.MinValue = (float)model.MinValue;
            AnswerSlider.MaxValue = (float)model.MaxValue;
            AnswerSlider.Value    = model.Answered ? (float)model.AnswerValue : (float)model.DefaultValue;

            ProgressView.Progress = AnswerSlider.Value / AnswerSlider.MaxValue;

            // Render the change continuously and not just when released
            //AnswerSlider.Continuous = true;
            //ProgressView.ProgressTintColor = AnswerSlider.MinimumTrackTintColor;
            //ProgressView.Hidden = true;

            AnswerSlider.ValueChanged += (sender, e) =>
            {
                Log.Information($"Setting value for {model.QuestionVariable} to {AnswerSlider.Value}");
                model.Answered        = true;
                model.AnswerValue     = AnswerSlider.Value;
                ProgressView.Progress = (AnswerSlider.Value / AnswerSlider.MaxValue);
            };
            this.SetNeedsDisplay();
        }
Пример #2
0
 public SectionQuestionTableSource(UITableView tableView, List <SurveyQuestion> viewModel, SurveyEntryViewModel baseViewModel) : base(tableView)
 {
     tableView.RegisterNibForCellReuse(UINib.FromName(SurveyQuestionViewCell.Key, NSBundle.MainBundle), SurveyQuestionViewCell.Key);
     this.TableSourceViewModel = viewModel;
     this.baseViewModel        = baseViewModel;
 }