New Posts New Posts RSS Feed: Child-Parent notifications.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Child-Parent notifications.

 Post Reply Post Reply
Author
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Topic: Child-Parent notifications.
    Posted: 02-Aug-2012 at 11:36am
Hi rbatistaole,
 
The CollectionChanged event will be triggered only if the collection itself changes (i.e. an OrderDetail is added or removed to the collection).
I'd suggest to instead listen to the property changed event on the OrderDetail EntityGroup. There, you'd add some logic to locate the parent Order of the OrderDetail changed and would manually raise the PropertyChanged on the Order.
 
 
Regards,
   Silvio.
Back to Top
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Posted: 31-Jul-2012 at 6:35pm
Hi.
Which is your suggestion to resolve the next problem.
I have an Order and OrderDetail entities.
class Order
{
..
public RelatedEntityList<OrderDetail> Details{ get {return null}};
public decimal Total
{
get { return this.Details.Sum(Amount);
}
}
 
class OrderDetail
{
public decimal Quantity..
public decimal Price..
public decimal Amount...
}
 
Now, when the Amount of OrderDetail change i need to raise an PropertyChanged of Order.Total to make the GUI refreshed, i need some notification from the OrderDetail to know about the change. I try to suscribe in the Order constructor to

Detalles.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Detalles_CollectionChanged);

and suscribe to each OrderDetail PropertyChanged event to receive notifications about the changes, but it is not working.
 
How do you resolve this problem?
 


Edited by rbautistaole - 01-Aug-2012 at 11:06am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down