Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danielchalmers/wpfwindowplacement

Win32 WindowPlacement helpers for WPF
https://github.com/danielchalmers/wpfwindowplacement

attached-properties helpers win32 windowplacement wpf

Last synced: 4 days ago
JSON representation

Win32 WindowPlacement helpers for WPF

Awesome Lists containing this project

README

        

# WpfWindowPlacement [![NuGet](https://img.shields.io/nuget/v/WpfWindowPlacement.svg)](https://www.nuget.org/packages/WpfWindowPlacement)

[WINDOWPLACEMENT](https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-windowplacement) helpers for WPF.

## Example

Define a [`WindowPlacement`](WpfWindowPlacement/WindowPlacement.cs) property.

```csharp
using WpfWindowPlacement;
WindowPlacement MyPlacement { get; set; }
```

Now use it in the XAML attached property or code-behind functions.

### XAML

```xaml
xmlns:wp="clr-namespace:WpfWindowPlacement;assembly=WpfWindowPlacement"

wp:WindowPlacementProperties.Placement="{Binding MyPlacement}"
```

### Code-behind

```csharp
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);
```

## License

[MIT License](LICENSE.md)