Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thoemmi/stickywindows
Make your top-level windows stick when moved or resized.
https://github.com/thoemmi/stickywindows
sticky windows winforms wpf
Last synced: about 1 month ago
JSON representation
Make your top-level windows stick when moved or resized.
- Host: GitHub
- URL: https://github.com/thoemmi/stickywindows
- Owner: thoemmi
- License: mit
- Created: 2017-02-17T21:59:17.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2018-10-19T22:59:55.000Z (about 6 years ago)
- Last Synced: 2024-05-02T18:20:17.547Z (8 months ago)
- Topics: sticky, windows, winforms, wpf
- Language: C#
- Size: 116 KB
- Stars: 25
- Watchers: 6
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StickyWindows
This library helps creating window applications where the windows can both stick to
screen borders and to each other.The code originates from the Codeproject article
[Sticky Windows - How to make your (top-level) forms to stick one to the other or to the screen](https://www.codeproject.com/Articles/6045/Sticky-Windows-How-to-make-your-top-level-forms-to)
by Corneliu Tusnea. He never published a NuGet package, so I asked for his permission
to both create a repository at GiutHub and publish it as a NuGet package.## Build status and NuGet packages
| | Stable | Pre-release |
|-------------------|----------------------------------------------------------------|----------------------------------------------------------|
| AppVeyor | [![Build status][appveyor-master-badge]][appveyor-master-link] | [![Build status][appveyor-dev-badge]][appveyor-dev-link] |
| StickyWindows | [![NuGet][nuget-master-badge]][nuget-master-link] | [![NuGet][nuget-dev-badge]][nuget-dev-link] |
| StickyWindows.Wpf | [![NuGet][nuget-master-wpf-badge]][nuget-master-wpf-link] | [![NuGet][nuget-dev-wpf-badge]][nuget-dev-wpf-link] |[appveyor-master-badge]: https://ci.appveyor.com/api/projects/status/ynjy63xrlvrrmseg/branch/master?svg=true
[appveyor-master-link]: https://ci.appveyor.com/project/thoemmi/stickywindows/branch/master
[appveyor-dev-badge]: https://ci.appveyor.com/api/projects/status/ynjy63xrlvrrmseg/branch/develop?svg=true
[appveyor-dev-link]: https://ci.appveyor.com/project/thoemmi/stickywindows/branch/develop
[nuget-master-badge]: https://img.shields.io/nuget/v/StickyWindows.svg
[nuget-master-link]: https://www.nuget.org/packages/StickyWindows
[nuget-dev-badge]: https://img.shields.io/nuget/vpre/StickyWindows.svg
[nuget-dev-link]: https://www.nuget.org/packages/StickyWindows
[nuget-master-wpf-badge]: https://img.shields.io/nuget/v/StickyWindows.WPF.svg
[nuget-master-wpf-link]: https://www.nuget.org/packages/StickyWindows.WPF
[nuget-dev-wpf-badge]: https://img.shields.io/nuget/vpre/StickyWindows.WPF.svg
[nuget-dev-wpf-link]: https://www.nuget.org/packages/StickyWindows.WPF## Usage
Actually there are two libraries published: one is for WinForms applications,
and the other one for WPF applications. The latter bases on the WinForms package
though. but this shouldn't be an issue as that the WinForms library is part of the
.NET framework and as such is always available.### WinForms
For WinForms application, use the
[**StickyWindow**](https://www.nuget.org/packages/StickyWindows)
package.In the **constructor** of your form add this line:
```csharp
new StickyWindows.StickyWindow(this);
```If you want to deviate from the default settings, `StickyWindow` provides following
boolean properties (which are all `true` by default:* `StickOnMove`
Allows the form to try to stick when the form is moved.
* `StickOnResize`
Allows the form to try to stick when the form is resized.
* `StickToOther`
Allows the form to try to stick to other stick-able forms.
* `StickToScreen`
Allows the form to try to stick to the screen margins.### WPF
For WinForms application, use the
[**StickyWindow.WPF**](https://www.nuget.org/packages/StickyWindows.WPF)
package.You have two options to make your windows "sticky":
1. Subscribe to your window's `Loaded` event and call the extension method
`CreateStickyWindow` in the handler:
```csharp
_stickyWindow = this.CreateStickyWindow();
```2. Use the `StickyWindowBehavior` in your XAML code (which I think is more elegant
than option 1):
```xml
...
```Both options support the same properties as the WinForms implementation.
> Please note that **StickyWindows.WPF** requires **System.Windows.Interactivity**,
> which is neither part of the library nor a dependency of the NuGet package. The point
> is, there's no official NuGet package for **System.Windows.Interactivity** by Microsoft.
> I decided against delivering this library as part of **StickyWindows.WPF** as it may
> conflict with different versions in other libraries you may be using potentially.## Version History
### v0.3 (not released yet)
* Fixed the MaximumSize and MinimumSize issue reported in #5 (Thanks to @lucky3)
* Added [SourceLink](https://github.com/dotnet/sourcelink) support### v0.2 (11-Apr-2017)
* Fixed strange margin when running on Windows 10 ([#1](https://github.com/thoemmi/StickyWindows/issues/1))
### v0.1 (10-Mar-2017)
* Inital Release