Table of Contents

Class Window

Namespace
Alternet.UI
Assembly
Alternet.UI.dll

Represents a window that makes up an application's user interface.

[ControlCategory("Hidden")]
public class Window : Control, IBaseObject, IDisposableObject, IInputElement, ISupportInitialize, IFocusable, IWin32Window, ITextProperty, IComponent, IDisposable
Inheritance
Window
Implements
Derived
Extension Methods

Examples

Here is how to declare a Window in UIXML:

<Window xmlns="http://schemas.alternetsoft.com/ui/2021"
        xmlns:x="http://schemas.alternetsoft.com/ui/2021/uixml"
        x:Class="Alternet.UI.Documentation.Examples.Window.MainWindow"
        Title="Window" Name="window">
</Window>

Also, a Window can be created from code:

var wnd = new Alternet.UI.Window();

Remarks

A Window is a representation of any window displayed in your application. The point of interaction between a user and a standalone application is a window. A Window consists of two distinct areas:

  • A non-client area, which hosts the window adornments, including a title, minimize button, maximize button, close button, and a border.
  • A client area that hosts application-specific content.

Examples of how a Window can look on different platforms:

Set Title property to specify the title of this window.

Constructors

Window()

Initializes a new instance of the Window class.

Properties

ActiveWindow

Gets the currently active window for this application.

BorderStyle

Gets or sets border style of the window.

CloseEnabled

Gets or sets a value indicating whether the window has an enabled close button.

ControlKind

Returns control identifier.

DefaultBounds

Gets or sets default location and position of the window.

DefaultDPI

Gets DPI of the first created window.

HasBorder

Gets or sets a value indicating whether the window has a border.

HasSystemMenu

Gets or sets whether system menu is visible for this window.

HasTitleBar

Gets or sets a boolean value indicating whether window has title bar.

Icon

Gets or sets the icon for the window.

IncFontSize

Gets or sets default control font size increment (in points) on normal dpi displays (DPI less or equal to 96). Default value is 0.

IncFontSizeHighDpi

Gets or sets default control font size increment (in points) on high dpi displays (DPI greater than 96). Default value is 2.

InputBindings

Gets the collection of input bindings associated with this window.

IsActive

Gets a value indicating whether the window is the currently active window for this application.

IsPopupWindow

Gets or sets a value indicating whether to create a special popup window.

IsToolWindow

A tool window does not appear in the Windows taskbar or in the window that appears when the user presses ALT+TAB. On Windows, a tool window doesn't have minimize and maximize buttons.

KeyPreview

Gets or sets a value indicating whether the form will receive key events before the event is passed to the control that has focus.

LogicalChildrenCollection

Returns a collection of elements which can be treated as "logical children" of this element.

MaximizeEnabled

Gets or sets a value indicating whether the window has an enabled maximize button.

Menu

Gets or sets the MainMenu that is displayed in the window.

MinimizeEnabled

Gets or sets a value indicating whether the window has an enabled minimize button.

Modal

Gets a value indicating whether this window is displayed modally.

OwnedWindows

Gets an array of Window objects that represent all windows that are owned by this window.

Owner

Gets or sets the window that owns this window.

Resizable

Gets or sets a value indicating whether the window can be resized by user.

ShowInTaskbar

Gets or sets a value indicating whether the form is displayed in the Windows or Linux taskbar.

StartLocation

Gets or sets the position of the window when first shown.

State

Gets or sets a value that indicates whether window is minimized, maximized, or normal.

StatusBar

Gets or sets the StatusBar that is displayed in the window.

Title

Gets or sets a title of this window.

Toolbar

Gets or sets the Toolbar that is displayed in the window.

TopMost

Gets or sets a value indicating whether the window should be placed above all non-topmost windows and should stay above them, even when the window is deactivated.

Visible

Gets or sets a value indicating whether the control and all its child controls are displayed.

Methods

Activate()

Activates the window.

ApplyStartLocation(Control?)

Applies StartLocation to the location of the window.

Close()

Closes the window.

Dispose(bool)

Disposes object's resources.

GetDefaultBounds()

Gets default bounds assigned to the window.

MakeAsPopup()

Initializes Window properties so it looks like popup window.

OnAlwaysOnTopChanged(EventArgs)

Called when the value of the TopMost property changes.

OnCloseEnabledChanged(EventArgs)

Called when the value of the CloseEnabled property changes.

OnClosed(EventArgs)

Raises the Closed event and calls OnClosed(EventArgs). See Closed event description for more details.

OnClosing(WindowClosingEventArgs)

Raises the Closing event and calls OnClosing(WindowClosingEventArgs). See Closing event description for more details.

OnHasBorderChanged(EventArgs)

Called when the value of the HasBorder property changes.

OnHasSystemMenuChanged(EventArgs)

Called when the value of the HasSystemMenu property changes.

OnHasTitleBarChanged(EventArgs)

Called when the value of the HasTitleBar property changes.

OnIconChanged(EventArgs)

Called when the value of the Icon property changes.

OnIsToolWindowChanged(EventArgs)

Called when the value of the IsToolWindow property changes.

OnMaximizeEnabledChanged(EventArgs)

Called when the value of the MaximizeEnabled property changes.

OnMenuChanged(EventArgs)

Called when the value of the Menu property changes.

OnMinimizeEnabledChanged(EventArgs)

Called when the value of the MinimizeEnabled property changes.

OnOwnerChanged(EventArgs)

Called when the value of the Owner property changes.

OnResizableChanged(EventArgs)

Called when the value of the Resizable property changes.

OnShowInTaskbarChanged(EventArgs)

Called when the value of the ShowInTaskbar property changes.

OnStateChanged(EventArgs)

Called when the value of the State property changes.

OnStatusBarChanged(EventArgs)

Called when the value of the StatusBar property changes.

OnToolbarChanged(EventArgs)

Called when the value of the Toolbar property changes.

PerformLayout(bool)

Forces the control to apply layout logic to child controls.

ShowAndFocus(bool)

Shows window and focuses it.

UpdateDefaultFont()

Updates default control font after changes in IncFontSizeHighDpi or IncFontSize. You should not call this method directly.

Events

AlwaysOnTopChanged

Occurs when the value of the TopMost property changes.

CloseEnabledChanged

Occurs when the value of the CloseEnabled property changes.

Closed

Occurs when the window is closed.

Closing

Occurs before the window is closed.

HasBorderChanged

Occurs when the value of the HasBorder property changes.

HasSystemMenuChanged

Occurs when the value of the HasSystemMenu property changes.

HasTitleBarChanged

Occurs when the value of the HasTitleBar property changes.

IconChanged

Occurs when the value of the Icon property changes.

IsToolWindowChanged

Occurs when the value of the IsToolWindow property changes.

MaximizeEnabledChanged

Occurs when the value of the MaximizeEnabled property changes.

MenuChanged

Occurs when the value of the Menu property changes.

MinimizeEnabledChanged

Occurs when the value of the MinimizeEnabled property changes.

OwnerChanged

Occurs when the value of the Owner property changes.

ResizableChanged

Occurs when the value of the Resizable property changes.

ShowInTaskbarChanged

Occurs when the value of the ShowInTaskbar property changes.

StateChanged

Occurs when the value of the State property changes.

StatusBarChanged

Occurs when the value of the StatusBar property changes.

TitleChanged

Occurs when the value of the Title property changes.

ToolbarChanged

Occurs when the value of the Toolbar property changes.