Maui: [BUG] Windows Popup control not centered after updating CommunityToolkit.Maui package to version 6.0.0
Is there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
I recently updated the CommunityToolkit.Maui package from version 5.3.0 to 6.0.0, and now the Popup control is no longer centered on my main page.
Setting HorizontalOptions=“Center” wouldn’t do anything. I tried setting the Anchor property on xaml and on code-behind but that wasn’t posable.
After some investigation, I found that the issue was caused by setting the FlowDirection property of my main content control (a Grid) to “RightToLeft”. When I removed this property or set it to “LeftToRight”, the Popup control was centered correctly. (It’s Like the popup being drawing from right to left)
So far it’s effect on Windows apps, but not Android, and idk about IOS.
I believe this is a bug in the CommunityToolkit.Maui package 6.0.0, and I would like to report it so that it can be fixed in future releases.
Versions used:
CommunityToolkit.Maui: 6.0.0 Please let me know if you need any further information or clarification.
I hope this helps!
Expected Behavior
The Expected Behavior should have been the same normal behavior of version 5.3.0. that is the Popup show at the center, not shifted to the right side of the screen.
Steps To Reproduce
- Just create a MAUI project.
- Add the package CommunityToolkit.maui version 6.0.0
- Initialize the .NET MAUI Community Toolkit by adding the below line of code .UseMauiCommunityToolkit()
the rest is the same in the documentation: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/popup
Change the FlowDirection=“RightToLeft” of the Main Content Control (say a Grid or a VerticalStackLayout) and some Labels or buttons.
run the project.
Link to public reproduction project repository
https://github.com/uSafi/Popup-Issue-on-CommunityToolkit.Maui-version-6.0.0
Environment
- .NET MAUI CommunityToolkit:
- OS: Windows 10.
It run normally on Android, IDK about IOS.
- .NET MAUI: 6.0.0
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 15 (7 by maintainers)
@uSafi , Thanks for your comment. I would like to modify it so that platforms other than Windows can also support FlowDirection.
@raselldev , If you do not provide the minimum code to reproduce the issue, I will not know whether the issue is resolved or not. Your problem sounds like a different problem, since the cause of this issue is the FlowDirection of the Popup’s Content.
Yes please fix it, On Windows and Android and iOS: the HorizontalOptions Start should show the Popup to the right when FlowDirection is RightToLeft, and to the left when HorizontalOptions is End also when FlowDirection is RightToLeft.
The Start of things in a Right To Left languages is always the right side, the End is the Left Side. And Thank you for all your help in this.
Yes, the behavior in the video is what I would expect
I would assume it’d be displayed on the left for
LeftToRight
and on the right forRightToLeft
.Thanks!
I too confirmed the bug on Windows exists in both v6.0.0 and the current main branch; ie https://github.com/CommunityToolkit/Maui/pull/1361 did not fix this bug.