New Posts New Posts RSS Feed: Does AfterSet stop OnPropertyChanged firing?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Does AfterSet stop OnPropertyChanged firing?

 Post Reply Post Reply
Author
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Topic: Does AfterSet stop OnPropertyChanged firing?
    Posted: 17-Aug-2009 at 9:52am
I have noticed that in many cases I have to manually raise OnPropertyChanged in our model. It seems (but I have not definitely confirmed) that any property that has an AfterSet defined requires that I have to trigger OnPropertyChanged myself. Is this truely the case or is there something else that might be causing this? If this is the case, is this by design?
 
Thanks for the help.
Back to Top
eileenv View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Jun-2007
Location: United States
Posts: 68
Post Options Post Options   Quote eileenv Quote  Post ReplyReply Direct Link To This Post Posted: 17-Aug-2009 at 6:25pm
OnPropertyChanged is automatically fired when the store backed property changes. Because the action caused by an AfterSet interceptor occurs after the backing value has already been written, it is be design that we don't fire OnPropertyChanged again.
Back to Top
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Posted: 18-Aug-2009 at 1:08pm
I did not express myself clearly, sorry.
 
Yes that makes sense for the property that triggered the afterset but I was referring to say in your afterset you set the value of other fields.
 
So in my UI I have 2 columns (for testings sake), they both are bould to Field1. Only one of the columns is editable. So I expect when I edit the value of Field1 in one column that it will magically show up in the other column(go magic!). I have an AfterSet for Field1 which then sets Field2 based on the value in Field1. Field2 is also bound to the UI. But when I change Field1, the other column which is bound to Field1 never refreshes and the column bound to Field2 never refreshes. That is, unless I manually raise OnPropertyChanged for both fields in the AfterSet.
 
I do NOT set the value of Field1 in the AfterSet, I only set the value of Field2. I expected Field2 to automatically raise its own OnPropertyChanged. In actuality I change the value of about 5 fields in that AfterSet, none of which are the field that triggered the AfterSet but I have to raise OnPropertyChanged on each one myself. Is this because they are getting set IN an AfterSet even though its not their AfterSet? Or could there be another reason why I am experiencing this?
Back to Top
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Posted: 18-Aug-2009 at 1:15pm
Oh and I forgot to add that each field that is being set in the AfterSet does have their own AfterSet trigger but that is NOT where they are getting changed. Something like this.
 
[AfterSet(Field1)]
public void SetOtherFields(IPropertyInterceptorArgs args)
{
  Field2="a";
  Field3="b";
  Field4="c";
}
 
[AfterSet(Field2)]
[AfterSet(Field3)]
[AfterSet(Field4)]
public void DoSomethingElse(IPropertyInterceptorArgs args)
{
  //do something random
}
 
Field2,Field3, and Field4 do not refresh in the UI unless I manually raise OnPropertyChanged
 
 
Back to Top
eileenv View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Jun-2007
Location: United States
Posts: 68
Post Options Post Options   Quote eileenv Quote  Post ReplyReply Direct Link To This Post Posted: 18-Aug-2009 at 3:33pm
In all the test cases I ran that mimicked your interceptors, OnPropertyChanged was fired each time. Can you create a reproducible case, perhaps based on one of our tutorials (to make things easier), and submit to support? That might help us trace through the code better.

Edited by eileenv - 18-Aug-2009 at 3:39pm
Back to Top
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Posted: 18-Aug-2009 at 3:44pm
Originally posted by eileenv

In all the test cases I ran that mimicked your interceptors, OnPropertyChanged was fired each time. Can you create a reproducible case, perhaps based on one of our tutorials (to make things easier), and submit to support? That might help us trace through the code better.
 
If I can find time I will. We are under the gun right now so thats why I threw the question out without one :) But at least you have confirmed this isn't the expect behavior so I will look into it further.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down