Skip to content

Commit

Permalink
UpgradeSettings should be true per default (DefaultValue works only f…
Browse files Browse the repository at this point in the history
…or Designer)
  • Loading branch information
punker76 committed Feb 25, 2015
1 parent df66c96 commit 509bd77
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 7 additions & 3 deletions MahApps.Metro/Controls/WindowSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public interface IWindowPlacementSettings
/// <summary>
/// Upgrades the application settings on loading.
/// </summary>
[DefaultValue(true)]
bool UpgradeSettings { get; set; }

/// <summary>
Expand Down Expand Up @@ -57,11 +56,16 @@ public WINDOWPLACEMENT? Placement {
}
}

private bool upgradeSettings = true;

/// <summary>
/// Upgrades the application settings on loading.
/// </summary>
[DefaultValue(true)]
public bool UpgradeSettings { get; set; }
public bool UpgradeSettings
{
get { return upgradeSettings; }
set { upgradeSettings = value; }
}
}

public class WindowSettings
Expand Down
13 changes: 13 additions & 0 deletions Mahapps.Metro.Tests/MetroWindowTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,18 @@ public async Task MinMaxCloseButtonsShouldBeHidden()
Assert.False(closeButton.IsVisible);
Assert.Equal(ResizeMode.CanResize, window.ResizeMode);
}

[Fact]
public async Task WindowSettingsUpgradeSettingsShouldBeTrueByDefault()
{
await TestHost.SwitchToAppThread();

var window = await WindowHelpers.CreateInvisibleWindowAsync<MetroWindow>();
window.SaveWindowPosition = true;

var settings = window.GetWindowPlacementSettings();
Assert.NotNull(settings);
Assert.Equal(true, settings.UpgradeSettings);
}
}
}

0 comments on commit 509bd77

Please sign in to comment.