I am showing a XAF window from a standard windows form. If I show the XAF window with a target of NewModalWindow my application stays running after I close the XAF window.
However, If I show the XAF window with a target of NewWindow my application shuts down when I close the XAF window.
I have attached a sample project that shows this behavior.
Closing XAF Window closes entire application
Answers approved by DevExpress Support
Hi Charles,
This issue is caused by the fact that the WinShowViewStrategyBase calls the Application.Exit method if there are no other XAF windows. The windows you are opening manually are modal, and are not taken into account.
UPDATED:
To overcome this issue, create a custom ShowViewStrategy and override the WinShowViewStrategyBase.ExitApplication method without calling the base method as follows:
C#public class MyShowViewStrategy : ShowInMultipleWindowsStrategy {
public MyShowViewStrategy(XafApplication app) : base(app) { }
protected override void ExitApplication() {
//base.ExitApplication();
}
}
I have modified your project accordingly. It is attached. Please let us know if this makes sense.
Thanks,
Michael.
Hi Michael,
I have the same issue with a Xaf Win Application version 18.1.4, but your code not working with this version… please could you show me how to prevent this behavior with my DevEx version?
Thanks,
Davide
@Davide: In the current version, to avoid this issue, you can override the WinShowViewStrategyBase.ExitApplication method without calling the base method.
I have updated the answer.