How do I refresh visual control properties (TextBlock.text) set inside a loop?
问题 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 complete. for (int i = 0; i < 50; i++) { System.Threading.Thread.Sleep(100); myTextBlock.Text = i.ToString(); } In VB6, I would call DoEvents() or control.Refresh . At the moment I'd just like a quick and dirty solution similar to DoEvents() , but I'd also like to know about alternatives or the "right" way to do this. Is there a