I'm using MVVM and want to bind a WebBrowser with my ViewModel(-property). I've used this method to do a bindable WebBrowser: http://pastebin.com/1SwwQgJZ
Anyway, I want to create dynamically a formular based on a XML file. My Application looks like this: The user opens the WPF-program and logs in with his account. After this, another View is being popped up, which contains a WebBrowser & the WPF contains a combobox with some XML files. The user can pick a XML file and based on it's content, the source of the WebBrowser will be renewed. I'd do it like this (just a snipped to show you how I'd create the HTML-file):
foreach(Question q in QuestionList)
foreach(Answer a in AnswerList)
_reportpage + = "<td> " + _reportpage + "</td>";
So I want to create a form, which looks later like this:
good middle bad
How do you feel? [ ] [ ] [X]
How was school? [X] [ ] [ ]
The [ ] are radiobuttons. Creating a form like this isn't the problem, the problem is to send the data back to the ViewModel... I'd like to know which answer the user clicked and save it to a list of 'Answer'. How am I supposed to do it?
Since I have to create dynamically a WPF-form and want to use this on WPF/WP8/W8/Silverlight, this method is in my eyes the best approach, since all the platforms can handle HTML.
Edit: I'm creating the HTML-file like this:
_reportpage = "<table border='2'>";
_reportpage += "<tr><td></td>";
foreach (T_Answer answer in AnswerList)
{
_reportpage += "<td>" + answer.Text + "</td>";
}
_reportpage += "</tr>";
foreach (T_Question tq in QuestionList)
{
_reportpage += "<tr><td>" + tq.Text + "</td>";
foreach (T_Answer ta in tq.Answer)
{
_reportpage += "<td><input type='radio' name='" + tq.ID + "' value='" + ta.Answer.ID + "'>" + ta.Answer.Text + "</td>";
}
_reportpage += "</tr>";
}
_reportpage += "</table>";
_reportpage += "<input type='button' value='Submit'>";