views:

57

answers:

2

I am currently developing a WPF application that will utilize existing WinForm dialogs. I'm experiencing a long lag between the time I call ShowDialog() on a WinForm to the time it is displayed.

Even when reusing WinForm dialog objects the lag time is nearly as bad on the second hit. Meaning that the problem isn’t in the constructor.

Does anybody have a work around to increase speed or know why the speed is so slow?

A: 

try use element host from the wpf interoperability dll.

Chen Kinnrot
A: 

A quick test with a blank WPF app and an empty Forms dialog on my machine indicates that the biggest delay comes from the "open window" animation that Win7 performs. So I think that there is no inherent performance problem in WPF-Forms interop. Rather, we're probably missing a crucial implementation detail about your dialog.

  • What is your dialog doing in Load and FormShown events? Maybe you are using inheritance and the offending code is further down in the hierarchy?
  • Are you using a 3rd party component suite? These tend to do quite a bit of initialization on startup.

Your best bet probably is to use a profiler to find out where the time is actually spent.

Sven Künzler