[DevExpress Support Team: CLONED FROM K18099: How to show a specific View at application startup, right after the logon window or after loading the main window]
How to set size of popup window to maximize in last example for winform ?
How to set size of popup window when ShowViewInPopupWindow() method is used
Answers approved by DevExpress Support
Hello,
To accomplish this task, handle the XafApplication.CustomizeTemplate event as follows:
C#using DevExpress.ExpressApp;
using dxT695689.Module.BusinessObjects;
using DevExpress.ExpressApp.Win.SystemModule;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Win;
using System.Windows.Forms;
namespace dxT695689.Module.Win.Controllers {
public class CustomWinShowStartupNavigationItemController : WinShowStartupNavigationItemController {
protected override void ShowStartupNavigationItem(ShowNavigationItemController controller) {
base.ShowStartupNavigationItem(controller);
((WinWindow)Application.MainWindow).Form.BeginInvoke(new MethodInvoker(() => {
IObjectSpace os = Application.CreateObjectSpace(typeof(Contact));
object theObjectToBeShown = os.FindObject<Contact>(null);
DetailView dv = Application.CreateDetailView(os, theObjectToBeShown, true);
dv.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
Application.CustomizeTemplate += Application_CustomizeTemplate;
Application.ShowViewStrategy.ShowViewInPopupWindow(dv);
Application.CustomizeTemplate -= Application_CustomizeTemplate;
}));
}
private void Application_CustomizeTemplate(object sender, CustomizeTemplateEventArgs e) {
((XafApplication)sender).CustomizeTemplate -= Application_CustomizeTemplate;
IWindowTemplate formTemplate = e.Template as IWindowTemplate;
if(formTemplate != null && formTemplate is System.Windows.Forms.Form) {
if(formTemplate is ISupportStoreSettings) {
((ISupportStoreSettings)formTemplate).SettingsReloaded += (sender1, e1) => {
((System.Windows.Forms.Form)sender1).WindowState = System.Windows.Forms.FormWindowState.Maximized;
};
} else {
((System.Windows.Forms.Form)formTemplate).WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
}
}
}
}
Let me know in case of any further difficulties.
Thanks,
Andrey
thank you for fast response this is what i lokking for.
I ahve few more coressponding question for using ListView in this code. These questions I put in separate : ticket
You are welcome. Your second question is in our queue. We will answer it shortly.
Thanks,
Andrey