RaisePropertyChanged problem

Hello,

I have subclassed GraphLinksModelNodeData to make my own nodes.
In my node, I have a property raising the PropertyChanged using the RaisePropertyChanged inherited:

public bool? Value
{
get
{
return this.inputValue;
}
private set
{
if (this.inputValue != value)
{
bool? old = this.inputValue;
this.inputValue = value;
this.RaisePropertyChanged(“Value”, old, value);
}
}
}

In my application, the Value property is set from another thread, so I’m using a dispatcher to call from the right thread:

private void UpdateValue()
{
// Execute in the right thread
if (this.UIDispatcher.Thread != Thread.CurrentThread)
{
this.UIDispatcher.BeginInvoke(new Action(this.UpdateValue));
return;
}
this.Value = this.memberValue.CurrentValue;
}

The setter is called and the RaisePropertyChanged is called as well.
My getter is not called back to get the correct value - I think it should. I looked when creating obects, it is calling back and updating properly.
I checked that we are in the right thread, it seems we are.

Any idea what can be wrong? What are you doing in the RaisePropertyChanged - I suppose you just raise the Property changed event.

Thx for any advice - I have no more idea why it is not behaving properly.

Normally one calls CheckAccess() to decide whether to call BeginInvoke or to just do it. I don’t know if your code is OK or not, though.

Is “this.inputValue” a field (data member) reference or a property/getter/setter reference? I assume it is the latter, since that makes it more likely that you know that it isn’t being called.

this.inputValue is a data field (private member variable) - only used here.

At what point should the Value property getter be called, even though it apparently isn’t being called? I don’t see what the problem really is.

Hello,

Sorry was my mistake - 2 bugs in our code that were hding the problem.

The RaisePropertyChanged was called effectively, but on a ghost object (not being anmyore binded) [1st bug].
It was not called on the current object - therefore not refreshed.

Sorry - thx for your help.