I'm reading the weight on a scale connected over a serial port. When the weight changed the scale returns an event. This event is working great but I can't change the value of a WPF element in the event handler (tried both labels and textboxes) with the new weight.
The event handler is inside the correct window class.
When I call a messagebox to display the weight all is fine.
Can anyone explain to me how to change the wpf elements after the event callback. This is my callback function.
public void OnWeightUpdate(string weight) {
if(String.IsNullOrEmpty(weight)) {
MessageBox.Show("Empty weight string, possible bad connection with scale");
}
else {
MessageBox.Show(weight);
LblScaleAmount.Content = weight;
}
}