With each loop iteration, I want to visually update the text of a textblock. My problem is that the WPF window or control does not visually refresh until the loop is complet
I tried the solution exposed here and it didn't work for me until I added the following:
Create an extension method and make sure you reference its containing assembly from your project.
public static void Refresh(this UIElement uiElement){
uiElement.Dispatcher.Invoke(DispatcherPriority.Background, new Action( () => { }));
}
Then call it right after RaisePropertyChanged:
RaisePropertyChanged("MyValue");
myTextBlock.Refresh();
That will force the UI thread to take control for a small while and dispatch any pending changes on the UI element.