I have a WPF application where I have the following StepCount property in my ViewModel that implements INotifyPropertyChanged, and then I snap to the TextBox in my view.
public int StepCount { get { return _stepCount; } set { _stepCount = value; OnPropertyChanged("StepCount"); } }
In XAML, here is what a DataBinding looks like:
<TextBox Text="{Binding Path=StepCount}" />
This works fine, and if I change the value of StepCount, the value of the Textbox is updated accordingly.
However, my problem is that I have another thread that increments StepCount, in which case the TextBox value is not updated. As soon as the stream ends, the value of the "Text box" will be updated to the correct value.
I need the Textbox value to be updated every time my other thread increases StepCount. As of now, the Textbox value only shows an update after the stream has completed.
Another thread increments StepCount, but the change is not displayed in the user interface until the thread ends.
Any ideas?
UPDATE
I appreciate all the answers. This question was puzzled because the previously working code seemed to be discontinued, as was the case with these specific bindings.
When I installed the beta version of VS 2011, it installed the beta version of .NET 4.5, and when I uninstall VS 2011 Beta under the suspicion that this might cause problems, it did not remove the beta version of .NET 4.5.
I just uninstalled the .NET 4.5 framework and performed a repair for the .NET 4.0 platform. After completing these steps, my data bindings worked correctly, and now the Textbox is updated correctly when another thread increases StepCount.
So, it looks like the .NET Framework Beta Framework may be causing data binding problems.
I will continue this by introducing a problem with Microsoft.
Thank you all for your answers.