Enumerator selectors
Back in Chapter 5, Data, we created a Contact model where we implemented a ContactType property with an EnumeratorDecorator. For the other string-based properties we’ve worked with in the book, a simple textbox is a fine solution for capturing data, but how can we capture an enumerated value? The user can’t be expected to know the underlying integer values of the enumerator, and asking them to type in a string representation of the option they want is asking for trouble. What we really want is a drop-down list that somehow utilizes the contactTypeMapper container we added to the class. We’d like to present the string descriptions to the user to pick from but then store the integer value in the EnumeratorDecorator object. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access