Window Class

A top-level window.

Definition

Namespace: Avalonia.Controls
Assembly: Avalonia.Controls (in Avalonia.Controls.dll) Version: 11.3.999
public class Window : WindowBase, IFocusScope, 
	ILayoutRoot
Inheritance
Object    AvaloniaObject    Animatable    StyledElement    Visual    Layoutable    Interactive    InputElement    Control    TemplatedControl    ContentControl    TopLevel    WindowBase    Window
Implements
IFocusScope, ILayoutRoot

Constructors

Window Initializes a new instance of the Window class.
Window(IWindowImpl) Initializes a new instance of the Window class.

Properties

ActualThemeVariant
(Inherited from StyledElement)
ActualTransparencyLevel Gets the achieved WindowTransparencyLevel that the platform was able to provide.
(Inherited from TopLevel)
Background Gets or sets the brush used to draw the control's background.
(Inherited from TemplatedControl)
BackgroundSizing Gets or sets how the control's background is drawn relative to the control's border.
(Inherited from TemplatedControl)
BorderBrush Gets or sets the brush used to draw the control's border.
(Inherited from TemplatedControl)
BorderThickness Gets or sets the thickness of the control's border.
(Inherited from TemplatedControl)
Bounds
(Inherited from Visual)
BypassFlowDirectionPolicies
(Inherited from TopLevel)
CanResize Enables or disables resizing of the window.
Classes
(Inherited from StyledElement)
ClientSize Gets or sets the client size of the window.
(Inherited from TopLevel)
Clip
(Inherited from Visual)
Clipboard Gets the platform's clipboard implementation
(Inherited from TopLevel)
ClipToBounds
(Inherited from Visual)
ClosingBehavior Gets or sets a value indicating how the Closing event behaves in the presence of child windows.
Content Gets or sets the content to display.
(Inherited from ContentControl)
ContentTemplate Gets or sets the data template used to display the content of the control.
(Inherited from ContentControl)
ContextFlyout Gets or sets a context flyout to the control
(Inherited from Control)
ContextMenu Gets or sets a context menu to the control.
(Inherited from Control)
CornerRadius Gets or sets the radius of the border rounded corners.
(Inherited from TemplatedControl)
Cursor
(Inherited from InputElement)
DataContext
(Inherited from StyledElement)
DataTemplates Gets or sets the data templates for the control.
(Inherited from Control)
DesiredSize
(Inherited from Layoutable)
DesktopScaling Gets the scaling factor for Window positioning and sizing.
(Inherited from WindowBase)
Effect
(Inherited from Visual)
ExtendClientAreaChromeHints Gets or Sets the ExtendClientAreaChromeHints that control how the chrome looks when the client area is extended.
ExtendClientAreaTitleBarHeightHint Gets or Sets the TitlebarHeightHint for when the client area is extended. A value of -1 will cause the titlebar to be auto sized to the OS default. Any other positive value will cause the titlebar to assume that height.
ExtendClientAreaToDecorationsHint Gets or sets if the ClientArea is Extended into the Window Decorations (chrome or border).
FlowDirection
(Inherited from Visual)
Focusable
(Inherited from InputElement)
FocusAdorner Gets or sets the control's focus adorner.
(Inherited from Control)
FocusManager
(Inherited from TopLevel)
FontFamily Gets or sets the font family used to draw the control's text.
(Inherited from TemplatedControl)
FontFeatures Gets or sets the font features turned on/off.
(Inherited from TemplatedControl)
FontSize Gets or sets the size of the control's text in points.
(Inherited from TemplatedControl)
FontStretch Gets or sets the font stretch used to draw the control's text.
(Inherited from TemplatedControl)
FontStyle Gets or sets the font style used to draw the control's text.
(Inherited from TemplatedControl)
FontWeight Gets or sets the font weight used to draw the control's text.
(Inherited from TemplatedControl)
Foreground Gets or sets the brush used to draw the control's text and other foreground elements.
(Inherited from TemplatedControl)
FrameSize Gets or sets the total size of the window.
(Inherited from TopLevel)
GestureRecognizers
(Inherited from InputElement)
HasMirrorTransform
(Inherited from Visual)
Height
(Inherited from Layoutable)
HorizontalAlignment
(Inherited from Layoutable)
HorizontalContentAlignment Gets or sets the horizontal alignment of the content within the control.
(Inherited from ContentControl)
Icon Gets or sets the icon of the window.
IgnoreVisibilityChanges
(Inherited from WindowBase)
InheritanceParent
(Inherited from AvaloniaObject)
InputPane
(Inherited from TopLevel)
InsetsManager
(Inherited from TopLevel)
IsActive Gets a value that indicates whether the window is active.
(Inherited from WindowBase)
IsArrangeValid
(Inherited from Layoutable)
IsEffectivelyEnabled
(Inherited from InputElement)
IsEffectivelyVisible
(Inherited from Visual)
IsEnabled
(Inherited from InputElement)
IsEnabledCore
(Inherited from InputElement)
IsExtendedIntoWindowDecorations Gets if the ClientArea is Extended into the Window Decorations.
IsFocused
(Inherited from InputElement)
IsHitTestVisible
(Inherited from InputElement)
IsInitialized
(Inherited from StyledElement)
IsKeyboardFocusWithin
(Inherited from InputElement)
IsLoaded Gets a value indicating whether the control is fully constructed in the visual tree and both layout and render are complete.
(Inherited from Control)
IsMeasureValid
(Inherited from Layoutable)
IsPointerOver
(Inherited from InputElement)
IsTabStop
(Inherited from InputElement)
IsVisible
(Inherited from Visual)
Item
(Inherited from AvaloniaObject)
Item
(Inherited from AvaloniaObject)
KeyBindings
(Inherited from InputElement)
Launcher
(Inherited from TopLevel)
LogicalChildren
(Inherited from StyledElement)
Margin
(Inherited from Layoutable)
MaxHeight
(Inherited from Layoutable)
MaxWidth
(Inherited from Layoutable)
MinHeight
(Inherited from Layoutable)
MinWidth
(Inherited from Layoutable)
Name
(Inherited from StyledElement)
OffScreenMargin Gets the window margin that is hidden off the screen area. This is generally only the case on Windows when in Maximized where the window border is hidden off the screen. This Margin may be used to ensure user content doesnt overlap this space.
Opacity
(Inherited from Visual)
OpacityMask
(Inherited from Visual)
OwnedWindows Gets a collection of child windows owned by this window.
Owner Gets or sets the owner of the window.
(Inherited from WindowBase)
Padding Gets or sets the padding placed between the border of the control and its content.
(Inherited from TemplatedControl)
Parent
(Inherited from StyledElement)
PlatformImpl Gets the platform-specific window implementation.
PlatformSettings
(Inherited from TopLevel)
Position Gets or sets the window position in screen coordinates.
Presenter Gets the presenter from the control's template.
(Inherited from ContentControl)
PseudoClasses
(Inherited from StyledElement)
RendererDiagnostics Gets a value indicating whether the renderer should draw specific diagnostics.
(Inherited from TopLevel)
RenderScaling
(Inherited from TopLevel)
RenderTransform
(Inherited from Visual)
RenderTransformOrigin
(Inherited from Visual)
RequestedThemeVariant Gets or sets the UI theme variant that is used by the control (and its child elements) for resource determination. The UI theme you specify with ThemeVariant can override the app-level ThemeVariant.
(Inherited from TopLevel)
Resources
(Inherited from StyledElement)
Screens Gets platform screens implementation.
(Inherited from WindowBase)
ShowActivated Gets or sets a value that indicates whether a window is activated when first shown.
ShowInTaskbar Enables or disables the taskbar icon
SizeToContent Gets or sets a value indicating how the window will size itself to fit its content.
StorageProvider File System storage service used for file pickers and bookmarks.
(Inherited from TopLevel)
StyleKey
(Inherited from StyledElement)
StyleKeyOverride
(Overrides StyledElement.StyleKeyOverride)
Styles
(Inherited from StyledElement)
SystemDecorations Sets the system decorations (title bar, border, etc)
TabIndex
(Inherited from InputElement)
Tag Gets or sets a user-defined object attached to the control.
(Inherited from Control)
Template Gets or sets the template that defines the control's appearance.
(Inherited from TemplatedControl)
TemplatedParent
(Inherited from StyledElement)
Theme
(Inherited from StyledElement)
Title Gets or sets the title of the window.
Topmost Gets or sets whether this window appears on top of all other windows
(Inherited from WindowBase)
Transitions
(Inherited from Animatable)
TransparencyBackgroundFallback Gets or sets the IBrush that transparency will blend with when transparency is not supported. By default this is a solid white brush.
(Inherited from TopLevel)
TransparencyLevelHint Gets or sets the WindowTransparencyLevel that the TopLevel should use when possible. Accepts multiple values which are applied in a fallback order. For instance, with "Mica, Blur" Mica will be applied only on platforms where it is possible, and Blur will be used on the rest of them. Default value is an empty array or "None".
(Inherited from TopLevel)
UseLayoutRounding
(Inherited from Layoutable)
VerticalAlignment
(Inherited from Layoutable)
VerticalContentAlignment Gets or sets the vertical alignment of the content within the control.
(Inherited from ContentControl)
VisualChildren
(Inherited from Visual)
VisualRoot
(Inherited from Visual)
Width
(Inherited from Layoutable)
WindowDecorationMargin Gets the WindowDecorationMargin. This tells you the thickness around the window that is used by borders and the titlebar.
WindowStartupLocation Gets or sets the startup location of the window.
WindowState Gets or sets the minimized/maximized state of the window.
ZIndex
(Inherited from Visual)

Methods

Activate Activates the window.
(Inherited from WindowBase)
AddHandler(RoutedEvent, Delegate, RoutingStrategies, Boolean)
(Inherited from Interactive)
AddHandler``1(RoutedEventUMP, EventHandlerUMP, RoutingStrategies, Boolean)
(Inherited from Interactive)
ApplyStyling
(Inherited from StyledElement)
ApplyTemplate
(Inherited from TemplatedControl)
Arrange(Rect)
(Inherited from Layoutable)
ArrangeCore(Rect) Overrides the core arrange logic for windows.
(Inherited from WindowBase)
ArrangeOverride(Size)
(Inherited from Layoutable)
ArrangeSetBounds(Size)
(Overrides WindowBaseArrangeSetBounds(Size))
BeginInit
(Inherited from StyledElement)
BeginMoveDrag(PointerPressedEventArgs) Starts moving a window with left button being held. Should be called from left mouse button press event handler
BeginResizeDrag(WindowEdge, PointerPressedEventArgs) Starts resizing a window. This function is used if an application has window resizing controls. Should be called from left mouse button press event handler
Bind(AvaloniaProperty, IBinding)
(Inherited from AvaloniaObject)
Bind(AvaloniaProperty, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableBindingValueUMP)
(Inherited from AvaloniaObject)
Bind``1(DirectPropertyBaseUMP, IObservableObject)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableBindingValueUMP, BindingPriority)
(Inherited from AvaloniaObject)
Bind``1(StyledPropertyUMP, IObservableObject, BindingPriority)
(Inherited from AvaloniaObject)
BuildEventRoute(RoutedEvent)
(Inherited from Interactive)
CheckAccess
(Inherited from AvaloniaObject)
ClearValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
ClearValue``1(AvaloniaPropertyUMP)
(Inherited from AvaloniaObject)
ClearValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
ClearValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
Close Closes the window.
Close(Object) Closes a dialog window with the specified result.
CoerceValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
EndInit
(Inherited from StyledElement)
EnsureInitialized Ensures that the window is initialized.
(Inherited from WindowBase)
Equals(Object)
(Inherited from AvaloniaObject)
ExtendClientAreaToDecorationsChanged(Boolean) 
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
Focus(NavigationMethod, KeyModifiers)
(Inherited from InputElement)
GetBaseValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
GetHashCode
(Inherited from AvaloniaObject)
GetTemplateFocusTarget Gets the element that receives the focus adorner.
(Inherited from TemplatedControl)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetValue(AvaloniaProperty)
(Inherited from AvaloniaObject)
GetValue``1(DirectPropertyBaseUMP)
(Inherited from AvaloniaObject)
GetValue``1(StyledPropertyUMP)
(Inherited from AvaloniaObject)
Hide Hides the window but does not close it.
(Overrides WindowBaseHide)
InitializeIfNeeded
(Inherited from StyledElement)
InvalidateArrange
(Inherited from Layoutable)
InvalidateMeasure
(Inherited from Layoutable)
InvalidateMirrorTransform
(Inherited from TopLevel)
InvalidateVisual
(Inherited from Visual)
IsAnimating(AvaloniaProperty)
(Inherited from AvaloniaObject)
IsSet(AvaloniaProperty)
(Inherited from AvaloniaObject)
IsVisibleChanged(AvaloniaPropertyChangedEventArgs)
(Overrides WindowBaseIsVisibleChanged(AvaloniaPropertyChangedEventArgs))
LogicalChildrenCollectionChanged(Object, NotifyCollectionChangedEventArgs)
(Inherited from Visual)
Measure(Size)
(Inherited from Layoutable)
MeasureCore(Size) Overrides the core measure logic for windows.
(Inherited from WindowBase)
MeasureOverride(Size)
(Overrides Layoutable.MeasureOverride(Size))
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnAccessKey(RoutedEventArgs)
(Inherited from InputElement)
OnApplyTemplate(TemplateAppliedEventArgs)
(Inherited from TopLevel)
OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)
(Inherited from TemplatedControl)
OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)
(Inherited from TopLevel)
OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)
(Inherited from Control)
OnClosed(EventArgs) Raises the Closed event.
(Inherited from WindowBase)
OnClosing(WindowClosingEventArgs) Raises the Closing event.
OnCreateAutomationPeer
(Overrides ControlOnCreateAutomationPeer)
OnDataContextBeginUpdate
(Inherited from StyledElement)
OnDataContextChanged(EventArgs)
(Inherited from StyledElement)
OnDataContextEndUpdate
(Inherited from StyledElement)
OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)
(Inherited from TemplatedControl)
OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)
(Inherited from Visual)
OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)
(Inherited from Control)
OnGotFocus(GotFocusEventArgs)
(Inherited from Control)
OnInitialized
(Inherited from StyledElement)
OnKeyDown(KeyEventArgs)
(Inherited from InputElement)
OnKeyUp(KeyEventArgs)
(Inherited from Control)
OnLoaded(RoutedEventArgs) Invoked just before the Loaded event.
(Inherited from Control)
OnLostFocus(RoutedEventArgs)
(Inherited from Control)
OnMeasureInvalidated
(Inherited from Layoutable)
OnOpened(EventArgs) Raises the Opened event.
(Inherited from WindowBase)
OnPointerCaptureLost(PointerCaptureLostEventArgs)
(Inherited from InputElement)
OnPointerEntered(PointerEventArgs)
(Inherited from InputElement)
OnPointerExited(PointerEventArgs)
(Inherited from InputElement)
OnPointerMoved(PointerEventArgs)
(Inherited from InputElement)
OnPointerPressed(PointerPressedEventArgs)
(Inherited from InputElement)
OnPointerReleased(PointerReleasedEventArgs)
(Inherited from Control)
OnPointerWheelChanged(PointerWheelEventArgs)
(Inherited from InputElement)
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
(Overrides WindowBaseOnPropertyChanged(AvaloniaPropertyChangedEventArgs))
OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)
(Inherited from Animatable)
OnResized(WindowResizedEventArgs) Raises the Resized event.
(Inherited from WindowBase)
OnSizeChanged(SizeChangedEventArgs) Invoked just before the SizeChanged event.
(Inherited from Control)
OnTemplateChanged(AvaloniaPropertyChangedEventArgs) Called when the Template property changes.
(Inherited from TemplatedControl)
OnTextInput(TextInputEventArgs)
(Inherited from InputElement)
OnUnloaded(RoutedEventArgs) Invoked just before the Unloaded event.
(Inherited from Control)
OnVisualParentChanged(Visual, Visual)
(Inherited from Layoutable)
RaiseEvent(RoutedEventArgs)
(Inherited from Interactive)
RaisePropertyChanged``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
RegisterContentPresenter(ContentPresenter) Called when an ContentPresenter is registered with the control.
(Inherited from ContentControl)
RemoveHandler(RoutedEvent, Delegate)
(Inherited from Interactive)
RemoveHandler``1(RoutedEventUMP, EventHandlerUMP)
(Inherited from Interactive)
Render(DrawingContext)
(Inherited from Visual)
RequestAnimationFrame(ActionTimeSpan) Enqueues a callback to be called on the next animation tick
(Inherited from TopLevel)
RequestPlatformInhibition(PlatformInhibitionType, String) Requests a PlatformInhibitionType to be inhibited. The behavior remains inhibited until the return value is disposed. The available set of PlatformInhibitionTypes depends on the platform. If a behavior is inhibited on a platform where this type is not supported the request will have no effect.
(Inherited from TopLevel)
SetAndRaise``1(DirectPropertyBaseUMP, UMP, UMP)
(Inherited from AvaloniaObject)
SetCurrentValue(AvaloniaProperty, Object)
(Inherited from AvaloniaObject)
SetCurrentValue``1(StyledPropertyUMP, UMP)
(Inherited from AvaloniaObject)
SetValue(AvaloniaProperty, Object, BindingPriority)
(Inherited from AvaloniaObject)
SetValue``1(DirectPropertyBaseUMP, UMP)
(Inherited from AvaloniaObject)
SetValue``1(StyledPropertyUMP, UMP, BindingPriority)
(Inherited from AvaloniaObject)
Show Shows the window.
(Overrides WindowBaseShow)
Show(Window) Shows the window as a child of owner.
ShowDialog(Window) Shows the window as a dialog.
ShowDialogTResult(Window) Shows the window as a dialog.
SortWindowsByZOrder(Window) Sorts the windows ascending by their Z order - the topmost window will be the last in the list.
StartRendering
(Inherited from TopLevel)
StopRendering
(Inherited from TopLevel)
ToStringReturns a string that represents the current object.
(Inherited from Object)
TryGetPlatformHandle Trys to get the platform handle for the TopLevel-derived control.
(Inherited from TopLevel)
TryGetResource(Object, ThemeVariant, Object)
(Inherited from StyledElement)
UpdateDataValidation(AvaloniaProperty, BindingValueType, Exception)
(Inherited from AvaloniaObject)
UpdateIsEffectivelyEnabled
(Inherited from InputElement)
UpdateLayout
(Inherited from Layoutable)
VerifyAccess
(Inherited from AvaloniaObject)

Events

Activated Fired when the window is activated.
(Inherited from WindowBase)
ActualThemeVariantChanged
(Inherited from StyledElement)
AttachedToLogicalTree
(Inherited from StyledElement)
AttachedToVisualTree
(Inherited from Visual)
BackRequested Occurs when physical Back Button is pressed or a back navigation has been requested.
(Inherited from TopLevel)
Closed Fired when the window is closed.
(Inherited from TopLevel)
Closing Fired before a window is closed.
ContextRequested Occurs when the user has completed a context input gesture, such as a right-click.
(Inherited from Control)
DataContextChanged
(Inherited from StyledElement)
Deactivated Fired when the window is deactivated.
(Inherited from WindowBase)
DetachedFromLogicalTree
(Inherited from StyledElement)
DetachedFromVisualTree
(Inherited from Visual)
DoubleTapped
(Inherited from InputElement)
EffectiveViewportChanged
(Inherited from Layoutable)
GotFocus
(Inherited from InputElement)
Holding
(Inherited from InputElement)
Initialized
(Inherited from StyledElement)
KeyDown
(Inherited from InputElement)
KeyUp
(Inherited from InputElement)
LayoutUpdated
(Inherited from Layoutable)
Loaded Occurs when the control has been fully constructed in the visual tree and both layout and render are complete.
(Inherited from Control)
LostFocus
(Inherited from InputElement)
Opened Fired when the window is opened.
(Inherited from TopLevel)
PointerCaptureLost
(Inherited from InputElement)
PointerEntered
(Inherited from InputElement)
PointerExited
(Inherited from InputElement)
PointerMoved
(Inherited from InputElement)
PointerPressed
(Inherited from InputElement)
PointerReleased
(Inherited from InputElement)
PointerWheelChanged
(Inherited from InputElement)
PositionChanged Fired when the window position is changed.
(Inherited from WindowBase)
PropertyChanged
(Inherited from AvaloniaObject)
Resized Occurs when the window is resized.
(Inherited from WindowBase)
ResourcesChanged
(Inherited from StyledElement)
ScalingChanged Gets or sets a method called when the TopLevel's scaling changes.
(Inherited from TopLevel)
SizeChanged Occurs when the bounds (actual size) of the control have changed.
(Inherited from Control)
Tapped
(Inherited from InputElement)
TemplateApplied Raised when the control's template is applied.
(Inherited from TemplatedControl)
TextInput
(Inherited from InputElement)
TextInputMethodClientRequested
(Inherited from InputElement)
Unloaded Occurs when the control is removed from the visual tree.
(Inherited from Control)

Fields

CanResizeProperty 
ClosingBehaviorProperty Defines the ClosingBehavior property.
ExtendClientAreaChromeHintsProperty 
ExtendClientAreaTitleBarHeightHintProperty 
ExtendClientAreaToDecorationsHintProperty Defines the ExtendClientAreaToDecorationsHint property.
IconProperty Defines the Icon property.
IsExtendedIntoWindowDecorationsProperty Defines the IsExtendedIntoWindowDecorations property.
OffScreenMarginProperty 
ShowActivatedProperty Defines the ShowActivated property.
ShowInTaskbarProperty Enables or disables the taskbar icon
SizeToContentProperty Defines the SizeToContent property.
SystemDecorationsProperty Defines the SystemDecorations property.
TitleProperty Defines the Title property.
WindowClosedEvent Routed event that can be used for global tracking of window destruction
WindowDecorationMarginProperty Defines the WindowDecorationMargin property.
WindowOpenedEvent Routed event that can be used for global tracking of opening windows
WindowStartupLocationProperty Defines the WindowStartupLocation property.
WindowStateProperty Represents the current window state (normal, minimized, maximized)

Extension Methods

BringIntoView Tries to bring the control into view.
(Defined by ControlExtensions)
BringIntoView(Rect) Tries to bring the control into view.
(Defined by ControlExtensions)
FindControlT(String) Finds the named control in the scope of the specified control.
(Defined by ControlExtensions)
FindDataTemplate(Object, IDataTemplate) Find a data template that matches a piece of data.
(Defined by DataTemplateExtensions)
GetControlT(String) Finds the named control in the scope of the specified control and throws if not found.
(Defined by ControlExtensions)
GetTemplateChildren
(Defined by TemplateExtensions)

See Also