InvokeRequired does not work in wpf.
The correct way to update a GUI element belonging to another thread is as follows:
Declare this at the module level:
delegate void updateLabelCallback(string tekst);
This is the method of updating your label:
private void UpdateLabel(string tekst) { if (label.Dispatcher.CheckAccess() == false) { updateLabelCallback uCallBack = new updateLabelCallback(UpdateLabel); this.Dispatcher.Invoke(uCallBack, tekst); } else {
source share