Avalonia: Fix main window not draggable by touch#4869
Merged
Gabriel Dufresne (GabrielDuf) merged 2 commits intoJun 3, 2026
Conversation
Copilot started reviewing on behalf of
Gabriel Dufresne (GabrielDuf)
June 3, 2026 15:59
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Improves Avalonia main-window title bar dragging on Windows for touch/pen users by introducing a manual drag implementation (workaround for BeginMoveDrag limitations with non-mouse pointers), addressing issue #4866.
Changes:
- Added manual drag state + pointer event handlers in
MainWindow.axaml.csfor touch/pen on Windows. - Updated title bar pointer-press logic to keep native OS drag for mouse (preserving Aero Snap) while using manual dragging for touch/pen.
- Wired up additional pointer events on the title bar drag area in XAML to support the new drag lifecycle.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/UniGetUI.Avalonia/Views/MainWindow.axaml.cs | Adds touch/pen-specific manual window dragging logic and related pointer event handlers. |
| src/UniGetUI.Avalonia/Views/MainWindow.axaml | Names the title bar drag area and hooks pointer moved/released/capture-lost events to drive manual dragging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Marc-André Moreau (mamoreau-devolutions)
approved these changes
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the window dragging experience for touch and pen users on Windows by implementing a custom, manual drag behavior for the title bar. This change addresses platform-specific limitations and ensures consistent behavior across pointer types. #4866
Title Bar Dragging Improvements:
PointerMoved,PointerReleased,PointerCaptureLost) to theTitleBarDragAreainMainWindow.axamlto support manual drag logic for touch and pen input._titleBarDragPointer,_titleBarDragOrigin) and logic to track and manage manual drag operations inMainWindow.axaml.cs.TitleBar_PointerPressedto distinguish between mouse and touch/pen input, using manual drag only for touch/pen on Windows. Mouse input continues to use the native drag behavior.TitleBar_PointerMoved,TitleBar_PointerReleased, andTitleBar_PointerCaptureLostmethods to handle moving the window, releasing the drag, and cleaning up drag state for touch/pen scenarios.These changes improve usability for touch and pen users, especially on Windows, by providing a smooth and reliable window dragging experience.