title: How do you center your main window in WPF?
body: <p>I have a WPF application and I need to know how to center the wain window programatically (not in XAML).</p>
  
  <p>I need to be able to do this both at startup and in response to certain user events. It has to be dynamically calculated since the window size itself is dynamic.</p>
  
  <p>What's the simplest way to do this? Under old Win32 code, I'd call the system metrics functions and work it all out. Is that still the way it's done or is there a simple <code>CenterWindowOnScreen()</code> function I can now call.</p>