Skip to content
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

Proposal: Add FlyoutPlacementMode.Center to the FlyoutPlacementMode enum. #10211

Open
AlexanderBlackman opened this issue Dec 2, 2024 · 1 comment
Labels
feature proposal New feature proposal needs-triage Issue needs to be triaged by the area owners

Comments

@AlexanderBlackman
Copy link

Desired Behaviour

When FlyoutPlacementMode.Center is selected, the Flyout should centre itself at the centre of the xaml root of the target element.

Rationale

  • It is troublesome to use margins to centre the flyout.
  • TeachingTipPlacementMode already has "Center", so adding it will improve consistency.
@AlexanderBlackman AlexanderBlackman added the feature proposal New feature proposal label Dec 2, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 2, 2024
@Lightczx
Copy link

Maybe that's why they didn't Add FlyoutPlacementMode.Center at first place

// Here we shamelessly contour ourselves to the Layout system and the whims of
// the implementers of Popup. The following truths must be known to understand
// this code:
// - ContentDialog has two modes, LayouRoot and EntireControl. When it is in the visual
// tree it cannot add itself to the popup, it's already the child of another UI element.
// As a result we transplant a specific part of the control template (LayoutRoot) to the
// popup.
// When it is not in the visual tree there's no way to apply the control template. We add
// the entire control to the visual tree in this scenario.
// - Popup is added to ContentDialog's children when ContentDialog is in LayoutRoot mode to
// allow inherited properties to work.
// - When Popup has no parent it positions its contents in the top left of the screen. When it
// has a parent it positions its contents at the top left of its parent. As a result when we are
// in LayoutRoot mode we must apply an inverse transform of the top left of the Popup's parent's
// position.
// - When a Popup has no parent it does not flip in place for RTL mode. As a result we have to apply
// a horizontal offset equal to the width of the popup (in our case the screen width) to the Popup
// when in EntireControl mode.
// - When a Popup has a parent it determines it position using the top left corner even in RTL mode.
// as a result we make sure the container is sized to zero pixels.
// - When a parented Popup is in RTL mode its position is determined by its right edge and not the left edge.
// - The Arrange pass is busted for RTL mode in Popup so don't expect any autosizing
// to work correctly. We force feed Popup its Width and Height instead of using Stretch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature proposal New feature proposal needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

2 participants