WINDOWPLACEMENT helpers for WPF.
Define a WindowPlacement
property.
using WpfWindowPlacement;
WindowPlacement MyPlacement { get; set; }
Now use it in the XAML attached property or code-behind functions.
xmlns:wp="clr-namespace:WpfWindowPlacement;assembly=WpfWindowPlacement"
<!-- Update size, position, and state on SourceInitialized and Closing -->
wp:WindowPlacementProperties.Placement="{Binding MyPlacement}"
using WpfWindowPlacement;
// Get window size, position, and state, and assign to MyPlacement.
MyPlacement = WindowPlacementFunctions.GetPlacement(this);
// Set window size, position, and state to the value of MyPlacement.
WindowPlacementFunctions.SetPlacement(this, MyPlacement);