Answer the question
In order to leave comments, you need to log in
NotifyPropertyChanged - what went wrong?
There is a GUI application (DevExpress, WPF, C#) based on MVVM, which was written by me and worked, the bindings in the controls worked and there were no problems with them. But suddenly, something was updated or something fell off or the stars did not converge, but the bindings stopped working adequately.
I'll try to describe the problem.
There is a Count property of some class that implements the INotifyPropertyChanged interface.
There is a TextBlock that displays the value of this property using Binding.
There is button number 1, which, using ICommand, asynchronously starts the procedure for scanning a folder on a disk. In the process, a small analysis of files and a count of the number occur with the corresponding increment of the Count property, which in turn sends a PropertyChanged event. The whole procedure happens asynchronously in Task.
There is another button #2 created for the test, which, when clicked, simply increments this Count property from the main thread.
When performing this sequence of actions, something happens that I cannot understand:
Answer the question
In order to leave comments, you need to log in
I would use Dispatcher.BeginInvoke() to increment Count from a background thread.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question