I am not a WPF expert. After tinkering for a few projects, this is my first full-fleged attempt. It isn't as simple as "Windows Forms", but the flexibility more than makes up for it!
I have an entity that houses all application settings. The user interfaces with them via a DatGrid. The Column is TextBox, but the content could be anything that a string can represent (text/string, date, integer, double, etc.).
To make things very easy for the user, and less bug-prone, I'd like to offer a [User?] Control that is appropriate for the data to be inserted (fictional approach below, might be impossible/impractical... consider it pseudo-code-ish):
I already have all the CRUD operations resolved, all the way back to the DB (that took a while to figure out, but with DBContext/Entities I am now a huge convert to WPF/EF6!
This app is in VB (VS2012Ult), but since I write in C# as well, I have no trouble converting any sample/example code.
disclaimer: This may seem clunky/silly as an approach, but users are notorious at entering things the wrong way, in the wrong format, etc. This approach is intended for non techies/coders to be able to reliably use the app without calling helpdesk as often.
note: A long time ago, this thread asked an extremely similar, if not identical, question. I am asking to see what has improved since then. I am not a WPF expert.
You're basically looking for a PropertyGrid
, similar to this:
1 - Easy way out: Use the (free, open source) Extended WPF toolkit linked above.
2 - Hard way out:
Build it yourself so that you can learn a lot of beautiful WPF and adapt it to your specific needs.
Use an ItemsControl
and several DataTemplate
s (one for each Data Type). Start by reading the ItemsControl link.