I'm using OOP and MVVM in a WPF c# application. The goal is for the resulting object (data-bound to user interface) to accurately represent a product. One specific area of the product is highly configurable. For conceptual purposes, imagine a boat which can have various means of propulsion. A submerged prop motor or above water fan motor may be attached at the stern, and they would have very different properties.
At the model level, I could have an interface typed property for this PropulsionDevice
, with the interface defining all the required information I need for pricing and weighting the finished product. How to assign this property based on user input is where I am unsure what to do. Creating an enumeration with an item for each class implementing my interface, and presenting it in a ComboBox
seems clunky and naive (the disconnect between the enum item and the class seems wrong). But, I'm not sure if meta-programming with Custom Attributes or using Reflection would be a better option. Maybe there is another option?
Any suggestions on how to allow for flexibility in my c# classes, as well as how to present this in the UI?