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