My VM has a property of my Model, Authorization
, which has a property of ActiveService
.
public Authorization Authorization
{
get
{
return this.authorization;
}
set
{
this.authorization = value;
NotifyOfPropertyChange();
}
}
I created an additional property on my ViewModel, called Services
to populate the dropdown with:
public IList<Service> Services
{
get { return services; }
set
{
services = value;
NotifyOfPropertyChange();
}
}
My View has a combobox
control named Services
. My understanding of Caliburn and it's conventions is that this should work. However it doesn't display my items correctly. It has the right number of items in the list but it only shows "Cannot find view for Models.Service"
Any help on what I'm doing wrong?
EDIT
So what I tried now is this; I manually set the DisplayMemberPath Binding like so:
DisplayMemberPath="{Binding Authorization_ActiveService_Description}"
and then I added an Override
to my Service
object on ToString()
like so:
public override string ToString()
{
return string.Format("{0}", this.Description);
}
This works, in that it now displays my Description in the DropDown. I'm a little confused though. I was able to remove the _Description
and it works the same. If I remove the Override it doesn't work at all.
Why doesn't it do the deep binding to my Description Property?