I had a need to make my WPF app remember it’s size, position and state for the main window. A bit of “Binging” and I eventually heard the sound of found. Turns out there are a couple ideas out there, but the WINDOWPLACEMENT solution from MSDN seemed to fit the bill the best.

This solution requires using some WIN32 API calls to get and set the information. The upside is that it seems to leverage the smarts built in to Windows regarding multi-monitor detection. The sample says that if the app was previously displayed on a secondary monitor that is no longer available, the app will show up on the available monitor instead. Nice.

The sample also shows how to store these settings in the App’s user settings store. I took this approach for now, but I have a feeling this will be relocated to a more generic location at some point in the future.

Cheers!