Ticket T695689
Visible to All Users

How to set size of popup window when ShowViewInPopupWindow() method is used

created 6 years ago

[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 ?

Answers approved by DevExpress Support

created 6 years ago (modified 6 years ago)

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

    Comments (2)
    JK JK
    Jacek Kosinski 6 years ago

      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

      Andrey K (DevExpress Support) 6 years ago

        You are welcome. Your second question is in our queue. We will answer it shortly.

        Thanks,
        Andrey

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.