pondelok, 1. októbra 2007

DoEvents in WPF

I developed some WPF application with ProgressBar control and I solved problem how to realize the equivalent of Application.DoEvents() method in WPF. WPF based solution using dispatcher is described here. But I discovered that for this purposes can be also well known System.Windows.Forms.Application.DoEvents() method used. It is very easy, just add reference to system.windows.forms.dll assembly and use this method exactly like in WinForms.
APress - Pro WPF in C# 2008Sams - Windows Presentation FoundationO'Reilly - Programming WPFWrox - Professional WPF Programming

2 komentáre:

Anonymný povedal(a)...

Hi,
You are absolutly right!
It works like a charm!

Thank you!

Claudio

Calciu Sorin povedal(a)...

Thank you. I am creating an animated gif in WPF and simply changing the textBlock.Foreground to another color while generating gif frames doesn't work. But using System.Windows.Forms.Application.DoEvents() after changing the Foreground solved my problem.