Signal (base class)
DigitalSignal -> derives from Signal class
- Value (type bool)
- Format -> (Not applicable)
AnalogSignal -> derives from Signal class
- Value (type ushort)
- Format -> AnalogSignalFormat enum type
SerialSignal -> derives from Signal class
- Value (type byte[])
- Format -> AnalogSignalFormat enum type
GridView is a collection of base class Signal type.
I want the set Format property to determine the signal formatting for the string representation of AnalogSignal and SerialSignal derived types (which is 2 entirely different enum types, and DigitalSignal has no Format property)... However I also want to be able to use the Conditional Formatting feature for this data column and not have it throw an exception when I try to use the number-based logic in that dialog (<, >, <=, >=, etc...) and have it apply to my AnalogSignal cells, and maybe the DigitalSignal cells where true could equate to 1, and false with 0 perhaps. Then the string-based conditional formatting logic to apply to the textual representation of whatever is seen in all cells that correspond with all 3 types of Signal's (my derived types).
If my Data property which is declared in my Signal class, which returns the overriden ToString() value returned from my derived class changes to 'System.Object' for instance and then my values are returned that way, where boxing/unboxing performance loss is involved, still... How would I know which row/cell corresponds with a particular signal type unless I map the object type for that cell from bool -> DigitalSignal, ushort -> AnalogSignal, and byte[] -> SerialSignal
as this seems kind of hacky?
I'm still having quite a bit of trouble thinking about a way that I can incorporate all of this into the mix because my derived classes have some very different behavior between each other but they need to be recognized under the Signal hierarchy so that I can have them all within the same collection/container. I use reflection to grab the enum values from the Format property for displaying in my combobox based on the Signal pulled from my SignalCollection, which works for the 2-way binding in my Format column (I can set the format by typing the name in there), but this gets tricky with being able to use the conditional formatting features the way I would like to use them since my GridView stores a collection of the base Signal class, and the Format enum between all 3 derived types is unique, but this is the value I need to use to determine the formatting for that derived signal type, and as a string, it doesn't help me much when I want to be able to apply numeric formatting rules to my AnalogSignal type.
Look at the attached image to see what I'm trying to *FIX*... To an end-user the screenshot results would make absolutely no sense.