[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Scheduler and Notifications
  [Collapse]Miscellaneous UI Customizations
    How to: Add a Button to a Detail View Using a Custom View Item
    How to: Add an XAF Mobile Custom Module
    How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET)
    How to: Adjust the Windows' Size and Style
    How to: Change an Application Logo and Info
    How to: Create a Custom Control Detail Item
    How to: Customize a Window Caption
    How to: Customize ASP.NET Layout Elements Using Custom CSS Classes
    How to: Customize Export Options of the Printing System
    How to: Customize the Conditional Appearance Module Behavior
    How to: Customize Window Status Messages (WinForms)
    How to: Enable High DPI Support in a WinForms Application
    How to: Implement a Custom Messaging Class
    How to: Implement Client-Side Logic in Mobile Applications
    How to: Include an Action to a Detail View Layout
    How to: Raise XAF Callbacks from Client-Side Events and Process these Callbacks on Server
    How to: Set Images and Captions for Enumeration Values
    How to: Show a Custom Window with an Embedded XAF View
    How to: Show a Custom Windows Form
    How to: Use a Custom Plugin in a Mobile Application
    How to: Use a DevExtreme Chart in a Mobile Application
    How to: Use Custom Themes in ASP.NET Applications
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Adjust the Windows' Size and Style

In WinForms XAF applications, end-users can drag the size grip in the bottom-right corner to resize windows. You can also customize the initial form size in code. This topic describes how to programmatically resize and customize windows depending on the displayed View. Pop-up dialog windows are used as an example.


A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4208.


A similar example for ASP.NET is available in the How to: Adjust the Size and Style of Pop-up Dialogs (ASP.NET) topic.

Expanded Set the Default Size and Style of Pop-up Windows

Popup windows can be customized in the XafApplication.CustomizeTemplate and Frame.TemplateChanged events. Create a new Window Controller and subscribe to either of these events when the Controller is activated (Controller.Activated event) as shown below.

In this code, the target window template is accessed by subscribing to the TemplateChanged event from a Controller. Then, handle the ISupportStoreSettings.SettingsReloaded event to make customizations after the default XAF template settings were applied. Also, you can handle the Form.HandleCreated or Form.Load event. Place your customization code into the OnFormReadyForCustomizations event handler.

As a result, the size of the target pop-up window is determined depending on the parent window size.

Expanded Customize a Pop-up Window Depending on its View

If you want to customize pop-up windows for a particular type, create a ObjectViewController<ViewType, ObjectType> Controller and specify the business object type. To maximize the DemoObject pop-up window, do the following:

See the example in the PopupWindowShowAction class description.


Certain form Templates (e.g., LookupForm, PopupForm, LookupControlTemplate) may have particular specifics.

  • Minimum form size may be set by default (the InitialMinimumSize property).
  • Size may be calculated dynamically based on the content.
  • The Form may have resizing restrictions (the IsSizeable property).
  • The Form size may automatically shrink (the AutoShrink property)
  • The Form may expand to occupy the whole space (the Maximized property).

Expanded See Also

Is this topic helpful?​​​​​​​