Persisting Window State

Aug 22, 2010 at 3:35 PM

I was wondering how others are storing the state of a window (position, size, etc...) between application runs? Specifically, I am interested in a WPF desktop application, but think this may be a useful discussion for SL and WP7 as well.

My current solution is to have a configuration service shared by views and and view models, and to use the event aggregator to notify when config loaded, or when it needs to be updated before saving. This works, but thought there may be other ways. This allows me to unit test my view-models, continue to have view ignorance in the view-model as well, but requires more code in the view code-behind. For me, that code 'feels' more like view-model code (state and such).