Skip to content

SaveWindowPosition does not upgrade WindowPlacementSettings on version change #1736

@mike-ward

Description

@mike-ward

When SaveWindowPosition is attached, the WindowPlacementSettings are not "upgraded" when the hosting program's version changes.

I don't see a way for a host to access the WindowPlacementSettings directly because they are protected and marked internal. It would also require a class definition to deserialize the window placement settings for each derived window type (I think). It seems possible the MahApps.Metro Library could upgrade these settings.

It appears based on my limited understanding that this could be accomplished as follows:

  • Add a UpgradeSettings property to IWindowPlacementSettings, which defaults to true
  • Add a void Upgrade() method to IWindowPlacementSettings, which is implemeneted by ApplicationSettingsBase
  • If on loading the UpgradeSettings flag is true, call _settings.Upgrade(), set the flag to false, and then _settings.Save()

This is the recommended way user settings are handled by programs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions