Browse Source

Property changes.

pull/1044/head
José Pedro 9 years ago
parent
commit
e54d0c75d1
  1. 13
      src/Avalonia.Controls/Window.cs
  2. 9
      src/Avalonia.Controls/WindowBase.cs

13
src/Avalonia.Controls/Window.cs

@ -78,9 +78,16 @@ namespace Avalonia.Controls
public static readonly StyledProperty<WindowIcon> IconProperty = public static readonly StyledProperty<WindowIcon> IconProperty =
AvaloniaProperty.Register<Window, WindowIcon>(nameof(Icon)); AvaloniaProperty.Register<Window, WindowIcon>(nameof(Icon));
/// <summary>
/// Defines the <see cref="WindowStartupLocation"/> proeprty.
/// </summary>
public static readonly DirectProperty<Window, WindowStartupLocation> WindowStartupLocationProperty =
AvaloniaProperty.RegisterDirect<Window, WindowStartupLocation>(nameof(WindowStartupLocation), o => o.WindowStartupLocation);
private readonly NameScope _nameScope = new NameScope(); private readonly NameScope _nameScope = new NameScope();
private object _dialogResult; private object _dialogResult;
private readonly Size _maxPlatformClientSize; private readonly Size _maxPlatformClientSize;
private WindowStartupLocation _windowStartupLoction;
/// <summary> /// <summary>
/// Initializes static members of the <see cref="Window"/> class. /// Initializes static members of the <see cref="Window"/> class.
@ -188,8 +195,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public WindowStartupLocation WindowStartupLocation public WindowStartupLocation WindowStartupLocation
{ {
get; get { return _windowStartupLoction; }
set; set { SetAndRaise(WindowStartupLocationProperty, ref _windowStartupLoction, value); }
} }
/// <inheritdoc/> /// <inheritdoc/>
@ -336,6 +343,8 @@ namespace Avalonia.Controls
{ {
if (WindowStartupLocation == WindowStartupLocation.CenterScreen) if (WindowStartupLocation == WindowStartupLocation.CenterScreen)
{ {
// This should be using a Screen API, but we don't have one yet and
// PlatformImpl.MaxClientSize is the best we have.
if (PlatformImpl != null) if (PlatformImpl != null)
{ {
var positionAsSize = PlatformImpl.MaxClientSize / 2 - ClientSize / 2; var positionAsSize = PlatformImpl.MaxClientSize / 2 - ClientSize / 2;

9
src/Avalonia.Controls/WindowBase.cs

@ -32,12 +32,13 @@ namespace Avalonia.Controls
/// <summary> /// <summary>
/// Defines the <see cref="Owner"/> property. /// Defines the <see cref="Owner"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<WindowBase> OwnerProperty = public static readonly DirectProperty<WindowBase, WindowBase> OwnerProperty =
AvaloniaProperty.Register<WindowBase, WindowBase>(nameof(Owner)); AvaloniaProperty.RegisterDirect<WindowBase, WindowBase>(nameof(Owner), o => o.Owner);
private bool _hasExecutedInitialLayoutPass; private bool _hasExecutedInitialLayoutPass;
private bool _isActive; private bool _isActive;
private bool _ignoreVisibilityChange; private bool _ignoreVisibilityChange;
private WindowBase _owner;
static WindowBase() static WindowBase()
{ {
@ -111,8 +112,8 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public WindowBase Owner public WindowBase Owner
{ {
get { return GetValue(OwnerProperty); } get { return _owner; }
set { SetValue(OwnerProperty, value); } set { SetAndRaise(OwnerProperty, ref _owner, value); }
} }
/// <summary> /// <summary>

Loading…
Cancel
Save