c# - Close all WPF windows from winforms application -
i host wpf application in winforms application via elementhost control. i've implemented logic listens unhandled exceptions on wpf side. if exception catched, elementhost control should disposed , related wpf windows should closed.
this works quite fine, if there 1 wpf window. since wpf application can open more sub windows (which undocked windows) windows not closed when dispose elementhost control.
is there easy way close wpf window , child windows winforms side?
i have tried application.openforms sub wpf windows not show (makes sense somehow ;-)).
one remark: own wpf code implement on wpf side, stick on win forms side.
also consider situations wpf window code might "stuck" , not able react , close self. that's why i'd kill windows "outside"
so made mind , followed cdkmoose recommendation let handled wpf part. it's idea let clean done 1 has knowledge has done. though!
Comments
Post a Comment