C # UWP Windows 10. In the class that implements INotifyPropertyChanged , there is a certain string to which the TextBlock is attached, everything works fine, but in one of the cases the string is assigned values from another Task stream and the UI does not respond to changes.
Actually the question is how to make the UI update?
Tried to assign a value through the window Dispatcher - does not work.
UPD
The call to update a variable occurs in another thread:
... await Window.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Balance = Account.GetBalance(); }); ... Setter Code
public string Balance { get{...} set { _balance = value; NotifyPropertyChanged(); } } Everything compiles, there are no errors, just when the code is executed in Task e - the UI does not update, the value changes according to the debugger.
INotifyPropertyChangedandDataBinding? Moreover, I do not have access to the form from the model, interaction in this direction is possible only through events - SYLDispatcherwindow - does not work." What is this description, you are a programmer, I hope? Give the code, and instead of "not working" an exact description of the error (exception? Is not compiled?). And yes, ifTaskruns in another thread, then: (1) you have to ask yourself the question, why in another, is this correct? (2) if everything is correct,Dispatcheris the right way, most likely an error in your code. - VladD