private void AddChildren(FormElement element)
 {
     if (element.Children.Count > 0)
     {
         var expander = new Expander();
         var panel = new FormPanel();
         foreach (var child in element.Children)
         {
             var visitor = new FormElementVisitorImpl();
             visitor.VisitFormElement(child);
             visitor.Result.Margin = new Thickness(20, 0, 0, 0);
             panel.Children.Add(visitor.Result);
         }
         expander.Content = panel;
         _result.Children.Add(expander);
     }
 }
Exemplo n.º 2
0
        private void DrawForm()
        {
            foreach (var element in form.Elements.Children)
            {
                var visitor = new FormElementVisitorImpl();
                visitor.VisitFormElement(element);
                var uiElement = visitor.Result;

                if (element is QuestionBase)
                {
                    var answer = formAnswer.FindOrCreateAnswer(element as QuestionBase);
                    uiElement.Answer = answer;
                }

                MyForm.Children.Add(uiElement);
            }
            var validate = new Button { Content = "Valider" };
            validate.Click += OnValidate;
            MyForm.Children.Add(validate);
        }