Saving WPF WIndow and Position -


What would be the best way to save the position and size of a window in a WPF app?

Currently, I am saving window size and WPF app status.

  • Windowclosures: Current information is saved in the backing store
  • (I copied it with an example).

    The problem is, when the window is minimized and restored, the last window closure setting is retrieved.

    > Now, the fire of state-transferred incident has decreased after the window, so it does not seem to be what I want.

    Thanks

    Do your own and your users and save settings at that time Use events and events if a process exits abnormally and the settings are not saved then the villain (cough ... finder ... cough ...)

    then only make sure To check the windowstate == Before saving the settings, it is generally clear that at least its or less To save the maximum window position makes no sense.

    As for loading the settings, it is okay that you can do just after the InitializeComponent call in the constructor or you can use the initial event. There is no real reason to use the SourceInitialized event unless you are doing something directly with the HWND which is not necessary.


    Comments