Skip to content

Commit ada352b

Browse files
committed
this should now really fix #1787
1 parent 4a50d06 commit ada352b

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

MahApps.Metro/Controls/WindowSettings.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,21 @@ public WINDOWPLACEMENT? Placement {
5656
}
5757
}
5858

59-
private bool upgradeSettings = true;
60-
6159
/// <summary>
6260
/// Upgrades the application settings on loading.
6361
/// </summary>
62+
[UserScopedSetting]
6463
public bool UpgradeSettings
6564
{
66-
get { return upgradeSettings; }
67-
set { upgradeSettings = value; }
65+
get
66+
{
67+
if (this["UpgradeSettings"] != null)
68+
{
69+
return (bool)this["UpgradeSettings"];
70+
}
71+
return true;
72+
}
73+
set { this["UpgradeSettings"] = value; }
6874
}
6975
}
7076

samples/MetroDemo/ExampleWindows/FlyoutDemo.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ public FlyoutDemo()
2323
e.Cancel = true;
2424
}
2525
};
26+
27+
var mainWindow = (MetroWindow)this;
28+
var windowPlacementSettings = mainWindow.GetWindowPlacementSettings();
29+
if (windowPlacementSettings.UpgradeSettings)
30+
{
31+
windowPlacementSettings.Upgrade();
32+
windowPlacementSettings.UpgradeSettings = false;
33+
windowPlacementSettings.Save();
34+
}
2635
}
2736

2837
public void Launch()

0 commit comments

Comments
 (0)