Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmccuaig/savewindowpos
https://github.com/dmccuaig/savewindowpos
persistence positioning wpf
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dmccuaig/savewindowpos
- Owner: dmccuaig
- Created: 2024-09-20T18:16:24.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-09-20T20:44:55.000Z (4 months ago)
- Last Synced: 2024-12-21T17:21:30.455Z (15 days ago)
- Topics: persistence, positioning, wpf
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Extension methods for saving and restoring the position of a WPF Window using JSON strings.
## Methods
```csharp
public static string GetWindowPositionString(Window w)
```
Gets the window position as a JSON string.
#### Parameters
[Window](https://learn.microsoft.com/en-us/dotnet/api/system.windows.window?view=windowsdesktop-8.0) `w` - The Window
#### Returns
[String](https://docs.microsoft.com/en-us/dotnet/api/system.string) The window position as a JSON string.```csharp
public static void RestoreWindowPosition(Window w, string wpStr)
```
Restores the window position from a JSON string.
#### Parameters
[Window](https://learn.microsoft.com/en-us/dotnet/api/system.windows.window?view=windowsdesktop-8.0) `w` - The Window
`wpStr` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string) JSON string```csharp
public static void EnsureIsVisible(Window w)
```
Ensure a window is visible on the screen. If it is partially hidden, snap it on screen.
#### Parameters
[Window](https://learn.microsoft.com/en-us/dotnet/api/system.windows.window?view=windowsdesktop-8.0) `w` - The Window