maui
maui copied to clipboard
Add support for iOS/Mac specific modals styled as popovers
Description of Change
Fixes #23975 by adding support for the iOS/Mac specific feature of modals styled as Popovers.
This is achieved by simply adding PlatformConfiguration.iOSSpecific.UIModalPresentationStyle.Popover, which maps to UIKit.UIModalPresentationStyle.Popover.
In order to specify where the popover is originating from, this PR also adds support for the following:
On<iOS>().SetModalPopoverView(Microsoft.Maui.Controls.View);On<iOS>().SetModalPopoverRect(System.Drawing.Rectangle);
Demo
https://github.com/user-attachments/assets/05bbe127-eeb7-4262-b621-0a660697d3e0
Example Usage
Parent page:
Page modalPage = new PopoverPage(originButton, Rectangle.Empty);
await Navigation.PushModalAsync(modalPage);
Modal page:
public partial class PopoverPage : ContentPage
{
public PopoverPage(View modalOrigin, Rectangle rectangle)
{
InitializeComponent();
On<iOS>().SetModalPopoverView(modalOrigin);
On<iOS>().SetModalPopoverRect(rectangle);
On<iOS>().SetModalPresentationStyle(presentationStyle);
}
}
@dotnet-policy-service agree
Since this introduces new APIs can you please target this for .NET 9? The net9.0 branch?
Sure, that's it done. There's a few conflicts now, mainly around the PublicAPI.Unshipped.txt files, but I'm not very familiar with these so unsure what the correct procedure is.
@piersdeseilligny API tracking is described here: https://github.com/dotnet/maui/blob/main/docs/design/APIChangeTracking.md. If you add new APIs, then there should be new entries in PublicAPI.Unshipped.txt file(s), basically.
CTRL+. in Visual Studio can add the missing entries to those text files for you. Not sure if VS Code can do the same.
/azp run
I rebased your PR, could you confirm the code still looks good? :)
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
/rebase
@piersdeseilligny Could you rebase and fix the conflicts? Let me know if need help in some way.
@jsuarezruiz let me know if that's all looking ok now? Sorry I don't have a good grasp on these PublicAPI .txt files so i'm not entirely sure if i merged everything correctly.
Can we rebase this on main please?
Any chance this could make it into .NET 9 SR2?
@jsuarezruiz @rmarinho We would also like to see this merged into MAUI.
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
/rebase
Azure Pipelines successfully started running 3 pipeline(s).
Not to nag, but any update on when this may get merged?
Azure Pipelines could not run because the pipeline triggers exclude this branch/path.
Successful build for .NET 10 is here: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=10992030&view=results (includes the latest changes done after this comment)