diff --git a/src/Perspex.Controls/Window.cs b/src/Perspex.Controls/Window.cs
index cf6a3c7190..84478f7bb7 100644
--- a/src/Perspex.Controls/Window.cs
+++ b/src/Perspex.Controls/Window.cs
@@ -14,327 +14,326 @@ using System.Collections.Generic;
namespace Perspex.Controls
{
- ///
- /// Determines how a will size itself to fit its content.
- ///
- public enum SizeToContent
- {
- ///
- /// The window will not automatically size itself to fit its content.
- ///
- Manual,
-
- ///
- /// The window will size itself horizontally to fit its content.
- ///
- Width,
-
- ///
- /// The window will size itself vertically to fit its content.
- ///
- Height,
-
- ///
- /// The window will size itself horizontally and vertically to fit its content.
- ///
- WidthAndHeight,
- }
-
- ///
- /// A top-level window.
- ///
- public class Window : TopLevel, IStyleable, IFocusScope, ILayoutRoot, INameScope
- {
- private static IList s_windows = new List();
-
- ///
- /// Retrieves an enumeration of all Windows in the currently running application.
- ///
- public static IList OpenWindows => s_windows;
-
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty SizeToContentProperty =
- PerspexProperty.Register(nameof(SizeToContent));
-
- ///
- /// Enables of disables system window decorations (title bar, buttons, etc)
- ///
- public static readonly StyledProperty HasSystemDecorationsProperty =
- PerspexProperty.Register(nameof(HasSystemDecorations), true);
-
- ///
- /// Defines the property.
- ///
- public static readonly StyledProperty TitleProperty =
- PerspexProperty.Register(nameof(Title), "Window");
-
- private readonly NameScope _nameScope = new NameScope();
- private object _dialogResult;
- private readonly Size _maxPlatformClientSize;
-
- ///
- /// Initializes static members of the class.
- ///
- static Window()
- {
- BackgroundProperty.OverrideDefaultValue(typeof(Window), Brushes.White);
- TitleProperty.Changed.AddClassHandler((s, e) => s.PlatformImpl.SetTitle((string)e.NewValue));
- HasSystemDecorationsProperty.Changed.AddClassHandler(
+ ///
+ /// Determines how a will size itself to fit its content.
+ ///
+ public enum SizeToContent
+ {
+ ///
+ /// The window will not automatically size itself to fit its content.
+ ///
+ Manual,
+
+ ///
+ /// The window will size itself horizontally to fit its content.
+ ///
+ Width,
+
+ ///
+ /// The window will size itself vertically to fit its content.
+ ///
+ Height,
+
+ ///
+ /// The window will size itself horizontally and vertically to fit its content.
+ ///
+ WidthAndHeight,
+ }
+
+ ///
+ /// A top-level window.
+ ///
+ public class Window : TopLevel, IStyleable, IFocusScope, ILayoutRoot, INameScope
+ {
+ private static IList s_windows = new List();
+
+ ///
+ /// Retrieves an enumeration of all Windows in the currently running application.
+ ///
+ public static IList OpenWindows => s_windows;
+
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty SizeToContentProperty =
+ PerspexProperty.Register(nameof(SizeToContent));
+
+ ///
+ /// Enables of disables system window decorations (title bar, buttons, etc)
+ ///
+ public static readonly StyledProperty HasSystemDecorationsProperty =
+ PerspexProperty.Register(nameof(HasSystemDecorations), true);
+
+ ///
+ /// Defines the property.
+ ///
+ public static readonly StyledProperty TitleProperty =
+ PerspexProperty.Register(nameof(Title), "Window");
+
+ private readonly NameScope _nameScope = new NameScope();
+ private object _dialogResult;
+ private readonly Size _maxPlatformClientSize;
+
+ ///
+ /// Initializes static members of the class.
+ ///
+ static Window()
+ {
+ BackgroundProperty.OverrideDefaultValue(typeof(Window), Brushes.White);
+ TitleProperty.Changed.AddClassHandler((s, e) => s.PlatformImpl.SetTitle((string)e.NewValue));
+ HasSystemDecorationsProperty.Changed.AddClassHandler(
(s, e) => s.PlatformImpl.SetSystemDecorations((bool) e.NewValue));
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public Window()
- : base(PlatformManager.CreateWindow())
- {
- _maxPlatformClientSize = this.PlatformImpl.MaxClientSize;
- }
-
- ///
- event EventHandler INameScope.Registered
- {
- add { _nameScope.Registered += value; }
- remove { _nameScope.Registered -= value; }
- }
-
- ///
- event EventHandler INameScope.Unregistered
- {
- add { _nameScope.Unregistered += value; }
- remove { _nameScope.Unregistered -= value; }
- }
-
- ///
- /// Gets the platform-specific window implementation.
- ///
- public new IWindowImpl PlatformImpl => (IWindowImpl)base.PlatformImpl;
-
- ///
- /// Gets or sets a value indicating how the window will size itself to fit its content.
- ///
- public SizeToContent SizeToContent
- {
- get { return GetValue(SizeToContentProperty); }
- set { SetValue(SizeToContentProperty, value); }
- }
-
- ///
- /// Gets or sets the title of the window.
- ///
- public string Title
- {
- get { return GetValue(TitleProperty); }
- set { SetValue(TitleProperty, value); }
- }
-
- ///
- /// Enables of disables system window decorations (title bar, buttons, etc)
- ///
- ///
- public bool HasSystemDecorations
- {
- get { return GetValue(HasSystemDecorationsProperty); }
- set { SetValue(HasSystemDecorationsProperty, value); }
- }
-
- ///
- /// Gets or sets the minimized/maximized state of the window.
- ///
- public WindowState WindowState
- {
- get { return this.PlatformImpl.WindowState; }
- set { this.PlatformImpl.WindowState = value; }
- }
-
- ///
- Size ILayoutRoot.MaxClientSize => _maxPlatformClientSize;
-
- ///
- Type IStyleable.StyleKey => typeof(Window);
-
- ///
- /// Closes the window.
- ///
- public void Close()
- {
- s_windows.Remove(this);
- PlatformImpl.Dispose();
- }
-
- protected override void HandleApplicationExiting()
- {
- base.HandleApplicationExiting();
- Close();
- }
-
- ///
- /// Closes a dialog window with the specified result.
- ///
- /// The dialog result.
- ///
- /// When the window is shown with the method, the
- /// resulting task will produce the value when the window
- /// is closed.
- ///
- public void Close(object dialogResult)
- {
- _dialogResult = dialogResult;
- Close();
- }
-
- ///
- /// Hides the window but does not close it.
- ///
- public void Hide()
- {
- using (BeginAutoSizing())
- {
- PlatformImpl.Hide();
- }
- }
-
- ///
- /// Shows the window.
- ///
- public void Show()
- {
- s_windows.Add(this);
-
- EnsureInitialized();
- LayoutManager.Instance.ExecuteInitialLayoutPass(this);
-
- using (BeginAutoSizing())
- {
- PlatformImpl.Show();
- }
- }
-
- ///
- /// Shows the window as a dialog.
- ///
- ///
- /// A task that can be used to track the lifetime of the dialog.
- ///
- public Task ShowDialog()
- {
- return ShowDialog