Sound weird? It really isn't.
I have a single entity that describes any kind of configuration in my app. The user today uses a treeview on the left, clicks on a node, and a simple 3 column grid comes up:
Setting - Value - Description
All of which are strings. And even though the values are all strings, I need the user to be offered a specific kind of UI 'editor' based on, perhaps, another non-displayed/hidden column. That hidden column would tell the "Value" column to offer the usera s choce of (for example):
TextBox, DatePicker, ComboBox, CheckBox, etc.
..but the content is still stored in the DB/Entity as a string. This way, I can add a new configuration setting on the fly, and don't need to change anything. I add sections to the treeview in the DB directly, as they seldom need to change.
Example:
![Image]()
On the right is my app as it is, and the left is just a test with PropertyGrid-which looks promising.
The only issue is that all I read tells me that PropertyGrid determines the 'editor' to allow the user to change it based on the actual property in the bound class. My bound class, though, has (essentially) just 3 properties (Setting, Value, Description), all of which String.
Problem:
-Any config items I need to have the user work with can be represented as a String value. BUT if I let them have a TextBox for all of them, they will mess them up, make typos, format dates wrong, you name it. I need to make things extremely easy.
Desired:
-In a separate column of the bound class, a value tells PropertyGrid which way to present the String (DatePicker, ComboBox, TextBox, CheckBox, etc.).
-The String value in the "Value" column (always a string) is presented in this fashion.
-The "Setting" and "Description" columns stay Textboxes no matter what.
"Why are you doing it this way?"
Well, in addition to the settings like what I've shown, I also have settings for countries, states, cities, and things that are really, really big. It is impractical to have this hard coded, as when one single thing needs adding, changing, deleting, I'm manually changing it in lots & lots of places. The solution above makes it super easy. My "ConfigItems" class is drop-dead simple.
Sound crazy?
Your thoughts?
TIA!
P.S. I'm new to WPF, having made about 6 projects in VS2012/VB with it, and have the excellent Pro WPF 4.5 in VB by Matthew MacDonald to work with. Up to now, things have been very simple, and I have not done anything in the way of Templates...
Can PropertyGrid do this? Can the XCTK DataGrid do it if the PropertyGrid can't? Am I way off base with this, and there is a much easier way?!
TIA!
pat
:)
I have a single entity that describes any kind of configuration in my app. The user today uses a treeview on the left, clicks on a node, and a simple 3 column grid comes up:
Setting - Value - Description
All of which are strings. And even though the values are all strings, I need the user to be offered a specific kind of UI 'editor' based on, perhaps, another non-displayed/hidden column. That hidden column would tell the "Value" column to offer the usera s choce of (for example):
TextBox, DatePicker, ComboBox, CheckBox, etc.
..but the content is still stored in the DB/Entity as a string. This way, I can add a new configuration setting on the fly, and don't need to change anything. I add sections to the treeview in the DB directly, as they seldom need to change.
Example:

On the right is my app as it is, and the left is just a test with PropertyGrid-which looks promising.
The only issue is that all I read tells me that PropertyGrid determines the 'editor' to allow the user to change it based on the actual property in the bound class. My bound class, though, has (essentially) just 3 properties (Setting, Value, Description), all of which String.
Problem:
-Any config items I need to have the user work with can be represented as a String value. BUT if I let them have a TextBox for all of them, they will mess them up, make typos, format dates wrong, you name it. I need to make things extremely easy.
Desired:
-In a separate column of the bound class, a value tells PropertyGrid which way to present the String (DatePicker, ComboBox, TextBox, CheckBox, etc.).
-The String value in the "Value" column (always a string) is presented in this fashion.
-The "Setting" and "Description" columns stay Textboxes no matter what.
"Why are you doing it this way?"
Well, in addition to the settings like what I've shown, I also have settings for countries, states, cities, and things that are really, really big. It is impractical to have this hard coded, as when one single thing needs adding, changing, deleting, I'm manually changing it in lots & lots of places. The solution above makes it super easy. My "ConfigItems" class is drop-dead simple.
Sound crazy?
Your thoughts?
TIA!
P.S. I'm new to WPF, having made about 6 projects in VS2012/VB with it, and have the excellent Pro WPF 4.5 in VB by Matthew MacDonald to work with. Up to now, things have been very simple, and I have not done anything in the way of Templates...
Can PropertyGrid do this? Can the XCTK DataGrid do it if the PropertyGrid can't? Am I way off base with this, and there is a much easier way?!
TIA!
pat
:)