I often have to deal with lists in the user interface that translate to an enum value in the 'ViewModel'. I know that I can directly bind ListView.ItemSource
to an enum via ObjectDataProvider
that provides the enum item names, but often this is not optimal, because the visual representation of a list item should differ from the enum item name.
Also, items from the enum sometimes need to be left out in the visual list representation.
so for example:
enum WhatIWantIsA {
NiceHouse,
FastCar,
Nothing // omitted in the view
}
Should translate to a list with the items:
A nice house
A fast car
So my question is: How do you deal with lists, that have a predefined number of entries and translate to an enum in the ViewModel
?