I'm planning a WPF application which will
- be able to create dynamic data entry forms (meaning the form gets the fields to display, their order, etc. from data in the database, not from the XAML)
- use the MVVM pattern if possible
Here is how I plan to go about it: in a Customer Data Entry View I would set the data context:
<UserControl.DataContext>
<vm:DynamicFormViewModel/>
</UserControl.DataContext>
and then include one element in my XAML as a placeholder for the form:
<UserControl.Content>
<view:DynamicFormView x:Name="CustomerEntry"/>
</UserControl.Content>
then in my ModelView I want to not have static properties but I want to build the XAML as one built HTML controls back in ASP.NET, in this fashion:
View view = new View();
view.Children.Add(...)
and in this way build the Grid based on the collection of data (firstname, lastname) and meta data (field label, field name, field helptext, field display order, etc.) which the ViewModel gets from the Model.
- has anyone built a WPF application that could create dynamic forms in this manner?
- did you use the MVVM pattern?
- is it possible to use the MVVM pattern in this way or does the MVVM pattern presuppose static fields in the View Model that are directly bound to static elements in the View?