.NET WPF: Problems repeatedly calling WPF form from a WinForm application -


as title states, i'm calling wpf form winform app, (with several classes on call stack between) numerous times. initially, wpf worked once. after googling, found had add shutdownmode.onexplicitshutdown wpf application create.

now, after adding that, upon exiting first wpf form, control never returns 'run' call , focus given winform dialog. if exit that, control returned wpf run.

winform:

application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); mainform form = new mainform(); application.run(form); 

wpf pre-init:

application = new system.windows.application {     shutdownmode = system.windows.shutdownmode.onexplicitshutdown }; 

calling wpf form:

confirmform form = new confirmform(); application.run(form); 

what going on here?:

application.run (in both winforms , wpf) blocking call runs message loop , returns when application ready exit.

you should call show(), shows form or window , returns immediately.

however, need call elementhost.enablemodelesskeyboardinterop tell wpf use winforms message loop.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -