-
Notifications
You must be signed in to change notification settings - Fork 778
Improve visual parent retrieval in ActionMessage #1020
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: master
Are you sure you want to change the base?
Conversation
Refactor visual parent retrieval logic for PopupRoot handling.
Introduce `popupUI` alias for `Primitives` namespace to streamline `Popup` control references across Windows.UI.Xaml, Avalonia, Microsoft.UI.Xaml, and System.Windows. Fix a bug in `PopupRoot` handling by correcting a variable name and updating logic for setting `pElement`. Remove unused code for cleaner implementation. Ensure consistency and adaptability with conditional compilation.
Refactor visual parent retrieval logic for PopupRoot handling.
Introduce `popupUI` alias for `Primitives` namespace to streamline `Popup` control references across Windows.UI.Xaml, Avalonia, Microsoft.UI.Xaml, and System.Windows. Fix a bug in `PopupRoot` handling by correcting a variable name and updating logic for setting `pElement`. Remove unused code for cleaner implementation. Ensure consistency and adaptability with conditional compilation.
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 refactors the visual parent retrieval logic in ActionMessage to properly handle PopupRoot elements across different UI platforms (WinUI, UWP, Avalonia, WPF). The change adds platform-specific namespace aliases and implements conditional logic to navigate up the visual tree through popup hierarchies.
Key changes:
- Added
popupUInamespace aliases for all platform-specific conditionals to access Popup primitives - Implemented special handling for PopupRoot elements to correctly traverse the visual tree hierarchy
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Simplified the condition checking for `currentElement` by directly verifying if it is a `popupUI.Popup` and its parent is also a `popupUI.Popup`. This refactoring removes unnecessary nesting and streamlines the logic. Adjusted conditional compilation directives to integrate assignments within the main condition block, enhancing code readability and maintainability.
Updated `Caliburn.Micro.Avalonia.csproj` and `Caliburn.Micro.Maui.csproj` to improve package management and documentation generation: - Added targets for managing project references and reference assemblies. - Prevented building project references when `NoBuild` is true. - Excluded `.xml` files from allowed output extensions. - Enabled XML documentation generation and disabled symbol package generation. Enhanced `ActionMessage.cs` to handle `PopupRoot` elements: - Added logic to determine the parent or placement target of popups. - Used conditional compilation for platform-specific behavior.
Removed logic for handling PopupRoot elements and setting pElement based on WINDOWS_UWP directive. This code was responsible for navigating the visual tree to find the appropriate parent or target for a popup element. Added a logging statement under the AVALONIA directive to log "SetMethodBinding avalonia," indicating a shift in focus towards Avalonia-specific functionality and possibly a change in how popups are managed in the application.
Refactor visual parent retrieval logic for PopupRoot handling.