I’m trying to display a ListBox inside of a GridViewColumn that needs to bind to a List of enums (List<ResourceType> Cost). The GridViewColumn‘s ListView is already bound to a collection of objects and I’m not really sure the best way to go about displaying the ListBox. Any suggestions?
I’m trying to display a ListBox inside of a GridViewColumn that needs to bind
Share
You can bind the
ListBoxto a list of enum values. An easy way to do that is to use the markup extension I posted here.Then, you need to bind the
SelectedItemof theListBoxto the property displayed in theGridViewColumn.You should end up with something like that :
EDIT: I think I misread your question… If I understand correctly, each object displayed in the
ListViewhas aCostproperty of typeList<ResourceType>, right ? (btw, the fact thatResourceTypeis an enum doesn’t matter here). So you just need to bind theListBoxto theCostproperty :