views:

597

answers:

4

Howdy,

Is there a pattern where in WPF, I can build a simple UI form from an XML like definition file pulled from a database?

It would allow the user to enter data into this form, and submit it back. The data would be sent back in an XML structure that would closely/exactly mimic the UI definition.

The definition should include the data-type, and if it was a required value or not. I would then like to map these data-types and required values to Data Validation Rules, so the form could not be submitted unless it passes the check.

It should also handle the ability to have lists of repeating data.

I am in the planning stages of this project and have fairly good flexibility in the design at this point, though I am pretty sure I need to stick to the desktop, not web since I may be doing some Office Inter-op stuff as well.

What technology stack would you recommend? I think XMAL and WPF may be close to the answer.

I have also looked at XUL, but it doesn't seem ready or useful for C#. (Found this article from MSDN in 2002)

Thank you,
Keith

A: 

Well if you wanted to roll something yourself, you can load and render dynamic XAML pretty easily. Rather than have users create XAML directly you could have a subset of it "mapped" to an XML format of your choosing that you XSL into valid XAML:

XmlReader tXml = XmlReader.Create(myXamlString);
UIElement MyElement = (UIElement)XamlReader.Load(tXml);
Steven Robbins
A: 

What about Caliburn?

rodbv
Looks promising. I see where it has some MVC/MVP capabilities, but I am not seeing where the View definition can reside in an external source.
Keith Sirmons
A: 

You might want to consider taking a look at the CSLA.NET framework. You can read about it here along with info on a well written book that's available:

http://www.lhotka.net/Default.aspx

-Eric

I've used CSLA quite a bit, but where would the dynamic forms fit in? I haven't checked out the latest versions, but I can see where the rules engine may come in play here.
Keith Sirmons
+1  A: 

Model View Presenter seems to suit WPF quite well, if you've not heard of it before check out the Supervisor Controller pattern, which is a subset of MVP (the author has renamed it to Supervisor Controller and Passive View as two different flavours of MVP). It is a design principal that will help you promote the separation of concerns and works much better than MVC when you don't have a framework to physically enforce it.

You could always try to create a view engine for ASP.NET MVC that works with WPF though, that would be nice.

Odd