My virtual machine has a property of my Authorization model, which has an ActiveService property.
public Authorization Authorization { get { return this.authorization; } set { this.authorization = value; NotifyOfPropertyChange(); } }
I created an additional property in my ViewModel called Services to populate the dropdown menu:
public IList<Service> Services { get { return services; } set { services = value; NotifyOfPropertyChange(); } }
My View has a combobox control named Services . My understanding of Calibern and its conventions is that this should work. However, it does not display my elements correctly. It has the correct number of items in the list, but only shows "Cannot find a view for Models.Service"
Any help on what I'm doing wrong?
EDIT
So now I have tried this; I manually set the DisplayMemberPath binding as follows:
DisplayMemberPath="{Binding Authorization_ActiveService_Description}"
and then I added an Override to my Service object on ToString() as follows:
public override string ToString() { return string.Format("{0}", this.Description); }
This works because it now displays my description in DropDown. Although I'm a little confused. I was able to remove _Description and it works the same. If I remove the override, it doesn't work at all.
Why doesn't he make a deep binding to my Description property?
source share