views:

23

answers:

0

Hi,

For my c# .net 3.5 application I need to display a whole load of various application settings to the user. I've started with a generic class called Setting that can hold either string, bools, datetimes, ints etc, for the various settings. I then have a list of these settings. Actually, the setting class implements an ISetting interface and then the list is defined as List so that a mix of settings can be stored together in the same list.

I had hoped to then set the datasource of a datagridview to this list. However, ISetting has a Value property of type object to expose the generic value of the Setting and it builds and runs and the value column in the grid converts everything to strings. This is not great, I had wanted bools either to be a checkbox or a true / false combo.

Strings are fine, but any ints for example get displayed as strings but then when it comes to changing the value in the cell, a whole load of casting issues arise and it doesn't work.

So I basically need a solution, for displaying a collection of settings of different types, all in the same grid. Kind of like a PropertyGrid but a propertygrid generally only deals with one object at a time, unless I can get it to show multiple objects on each row.

I was just wondering if there is a common approach people use to display there configurable application settings of different types to the user. Any links would be most helpful. I've tried searching but can't seem to find a great deal.

Many thanks