private void SetResults(ValueTable results) { foreach (QuestionWidget questionWidget in QuestionFlowLayout.Controls) { questionWidget.Visible = results.HasValue(questionWidget.QuestionName); if (results.HasValue(questionWidget.QuestionName)) { Value result = results.Get(questionWidget.QuestionName); if (!result.IsUndefined) { questionWidget.SetValue(result); } } } }
public void SetResults(ValueTable results) { // We need to set the parent control to 'visible' before we can change the Visible property // of any child controls. Visible = true; foreach (QuestionWidget questionWidget in _questionWidgets) { questionWidget.Visible = results.HasValue(questionWidget.QuestionName); if (results.HasValue(questionWidget.QuestionName)) { Value result = results.Get(questionWidget.QuestionName); if (!result.IsUndefined) { questionWidget.SetValue(result); } } } Visible = _questionWidgets.Any(widget => widget.Visible); }