RaisePropertyChanged doesn't updates the diagram

Hi everyone!
I’m trying to make my diagram update when i change an value on my code but that it’s not working. I show you next some code to explain what i did exactly.
I create a BaseNodeData class with one property called Message that is binded to a textblock on my diagram. The BaseNodeData class also implements an array of objects called Outputs from a class called IOTagBit that is a child of the BaseNodeData class

public class <b>BaseNodeData </b>: GraphLinksModelNodeData<String>
{
    protected IOTagBit[] inputs;
    protected IOTagBit[] outputs;

    private string _message;

    public string Message
    {
        get { return _message; }
        set
        {
            if (_message != value)
            {
                string old = _message;
                _message = value;
                RaisePropertyChanged("Message", old, value);
            }
        }
    }

    public string NodeType { get; set; }


    protected IOTagBit[] _outputs;
    public IOTagBit[] Outputs
    {
        get { return _outputs; }
        set
        {
            if (_outputs != value)
            {
                IOTagBit[] old = _outputs;
                _outputs = value;
                RaisePropertyChanged("Outputs", old, value);
            }
        }
    }
}

The class IOTagBit implements the INotifyPropertyChanged interface to detect the “IOTagBit” raisePropertyChanged. What happens is that the method protected void RaisePropertyChanged is fired but the the event this.PropertyChanged is always null and so i cannot update my diagram. Actually i also tried to update the Message property (this.Message = “TT”;) outside the if condition but the diagram still not updates.

public class <b>IOTagBit </b>: <b>BaseNodeData, INotifyPropertyChanged</b>
{
    bool value;

    public bool ReadBit() { return value; }
    public void WriteBit(bool value)
    {
        bool old = this.value;
        this.value = value;
        <b>RaisePropertyChanged("IOTagBit", old, value);</b>
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected void RaisePropertyChanged(String pname, Object oldval, Object newval)
    {
        

        if (this.PropertyChanged != null)
        {
            this.Message = "TT";
        }
    }
}

Can you help me? What i’m doing wrong?
Thanks in advance.

Best regards,
Ricardo

How did you declare the XAML?

You might want to look at the data classes in the DynamicPorts sample, where each node holds lists of data.

Hi Walter.
This is how i declare the xaml (binding a textblock to Message property):

The example that you suggest (DynamicPorts) use ObservableCollections to implement lists of data but the data is only readable. I need to set(write) my data :(

Thanks for your attention.

Ricardo

The Socket class in DynamicPorts does have one settable property, Color. The point is that it implements RaisePropertyChanged not only by doing the usual calling of the PropertyChanged event handlers, but also by calling PropertyChanged handlers on the Unit class, which is the node data class.

The other point I should mention is that meaningful changes to model data should be performed within a transaction.

I decided to create a simple program to find more clearly where is the problem for the raisePropertyChanged fail. The conclusion that i get was that if a made RaisePropertyChanged(“PropertyName”, old, value) inside my BaseNodeClass (public class BaseNodeData : GraphLinksModelNodeData) everything goes fine but if i create a subclass from BaseNodeClass (like public class BitInput : BaseNodeData without INotifyPropertyChanged interface) and made a RaisePropertyChanged(“PropertyName”, old, value) that will fail. I cannot understand what is going on. Can you help me please? Thanks

I realize now what i’m doing wrong. The name that i put on RaisePropertyChanged (RaisePropertyChanged(“Output”, old, value) ) was not the name of my property. Distraction, sorry… Thanks for your support!