The Wpf combo box allows editing, and this is fine if all your combo box items are strings, or have a ToString() method defined on them.
When you select an item, it is displayed as Text, it does not use a DataTemplate, it just calls ToString() on the item that is selected.
I get a list of items in my combo drop down that are formatted using my item template, when i select one i get the name of the object i.e. MyNamespace.MyObjectName
Some solutions have been
- use ValuePath to bind to a property
on the object, but if you require
your display to be more than one of
these, bad luck.
- implement the ToString() method on
your object
is there another way around?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…