WPF MVVM Combobox based on Entity Framework values does not raise property changed notification -
i have succesfully used mvvm principles in former projects, i'm stuck ... basic!
using ef4.1 (code first approach) data storage access works fine. created following class:
public class photo { [key] public int photoid { get; set; } public string year { get; set; } public byte[] thumbnail { get; set; } public datetime inserttime { get; set; } //insertion time public datetime updatetime { get; set; } //last modification time //navigational properties public virtual image image { get; set; } public virtual monument monument { get; set; }//a photo belongs specific monument public virtual mdpremisesspace mdpremisesspace { get; set; } //a photo shot @ specific premises space public virtual mdrestauration mdrestauration { get; set; }//a photo has restauration public virtual mdmaintenance mdmaintenance { get; set; }//a photo has maintenance public virtual mdtype mdtype{ get; set; }//a photo has type public virtual user insertuser { get; set; } //the user inserted reocord public virtual user updateuser { get; set; } //the user lastly modified reocord //constructor public photo() { } }
created viemodel based on class (i 'm using viewmodel based on generics, resuse whereever can - success), implements inotifypropertychanged.in viewmodel there property called monuments defined way (works fine):
private observablecollection<model.monument> monuments = new observablecollection<model.monument>(); public observablecollection<model.monument> monuments { { return monuments; } private set { monuments = value; } }
created view in used combobox this:
<combobox name="cmbmonument" grid.row="1" grid.column="1" width="200" horizontalalignment="left" itemssource="{binding path=monuments }" selecteditem="{binding path=selectedrecord.monument,mode=twoway, updatesourcetrigger=propertychanged}" displaymemberpath="name" />
the values showing correclty (and can saved correctly).
but:
is there can explain why changing selected item in combobox, not raise property change notification??
if change year property notification raised!!
(i'm suspecting fact monument property in photo class above navigational property...but if that, shouldn't raise notification?)
any hints welcome!!
according this site may bug.
what notification expect? binding changes monument property, if setter of property not raise notifications not notifications.
Comments
Post a Comment