Make an ActiveX control close its WPF parent form
I have a custom WinForms ActiveX toolbar control that I want to add to a WPF form. One of the options on the toolbar is to exit the current application.
How 开发者_开发百科can I make the control raise/bubble an event to close the WPF window that contains the control?
Whatever the technology of your toolbar control, there must be some way to associate a toolbar element click with code in your application (via a delegate, event, etc.). Create a method that closes your application and associate it with this toolbar element. See the docs for the Application.Shutdown method for more explanation on terminating the WPF app (including the ShutdownMode enum).
精彩评论