-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Code Quality: Connected drag events to Omnibar #17245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR connects drag-and-drop events for breadcrumb items in the Nav toolbar (Omnibar) by updating the ViewModel logic, wiring handlers in code-behind, and exposing the new events in XAML.
- Changed event handler casts in ViewModel from
StackPanel
toFrameworkElement
and added null checks - Added wrapper methods in
NavigationToolbar.xaml.cs
to forward drag events to the ViewModel - Updated
NavigationToolbar.xaml
to setAllowDrop
and attachDragLeave
,DragOver
, andDrop
handlers
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs | Updated casting to FrameworkElement , added null guard and path exclusions |
src/Files.App/UserControls/NavigationToolbar.xaml.cs | Introduced new event handler methods that call ViewModel |
src/Files.App/UserControls/NavigationToolbar.xaml | Enabled AllowDrop and hooked up drag-and-drop events |
Comments suppressed due to low confidence (1)
src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs:523
- [nitpick] Consider adding unit or integration tests for the new drag-and-drop methods (
PathBoxItem_DragLeave
,PathBoxItem_DragOver
,PathBoxItem_Drop
) to ensure these event handlers are exercised and behave correctly.
public async Task PathBoxItem_DragOver(object sender, DragEventArgs e)
src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs
Outdated
Show resolved
Hide resolved
DataContext="{x:Bind}" | ||
DragLeave="PathBoxItem_DragLeave" | ||
DragOver="PathBoxItem_DragOver" | ||
Drop="PathBoxItem_Drop" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a more proper name: BreadcrumbBarItem_Drop, etc. PathBoxItem has been inappropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it the same event that works with the existing Breadcrumb box, as well as the Omnibar one? If so, BreadcrumbItem_Drop/DragOver/DragLeave is approriate. Not BreadcrumbBar.
If these are separate events only for the Omnibar, then something like OmnibarBreadcrumbItem_Drop/DragOver/DragLeave would be more accurate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review! I pushed a commit with this change.
Resolved / Related Issues
To prevent extra work, all changes to the Files codebase must link to an approved issue marked as
Ready to build
. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.