QuoteReplyTopic: propertychanged event for mvvm Posted: 23-Jul-2010 at 3:08pm
The PropertyChanged events do not fire when the entity is in a detached state (this is the state a new entity is in before adding it to an EntityManager). Once you call entityManager.AddEntity(myEmployee) it will start firing.
I'm trying to implement mvvm in my class. I want to catch the propertychanged event in the entity class and bubble it up.
Using your simplecombobox project as an example I added the following class to the simplecombodemo project. Am I catching the propertychanged event correctly? Because I am not getting the propertychanged event when I do Class1.Employee.Address="abc"
using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.ComponentModel; using IdeaBlade.EntityModel;
namespace SimpleComboDemo { public class Class1 { private Employee myEmployee; public string propname; public Employee Employee { get { return myEmployee; } }
public Class1() { myEmployee = new Employee(); myEmployee.PropertyChanged += new PropertyChangedEventHandler(MyCust_PropertyChanged); } private void MyCust_PropertyChanged(object sender, PropertyChangedEventArgs e) { var propchange = e.PropertyName; } } }
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum