I don't know if this still is wanted but I give a solution for using Popup's.
The Popup control xaml:
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup
x:Class="MauiTest.Controls.PopupControl"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
CanBeDismissedByTappingOutsideOfPopup="True"
HorizontalOptions="Center"
Color="White">
<Grid
Margin="10,10,10,10"
HorizontalOptions="Center"
RowDefinitions="*,*,2, *"
VerticalOptions="Center">
<Button
x:Name="Button1"
Grid.Row="0"
BackgroundColor="Transparent"
Clicked="Button1_Clicked"
Text="Menu Item 1"
TextColor="Black" />
<Button
x:Name="Button2"
Grid.Row="1"
BackgroundColor="Transparent"
Clicked="Button2_Clicked"
Text="Menu Item 2"
TextColor="Black" />
<BoxView Grid.Row="2" Color="LightGray" />
<Button
x:Name="Button4"
Grid.Row="3"
BackgroundColor="Transparent"
Clicked="Button3_Clicked"
Text="Menu Item 3"
TextColor="Black" />
</Grid>
</toolkit:Popup>
The Popup code behind:
using CommunityToolkit.Maui.Views;
using MauiTest.Views;
namespace MauiTest.Controls;
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PopupControl : Popup
{
public PopupControl()
{
InitializeComponent();
}
private void Button1_Clicked(object sender, EventArgs e)
{
Close(new TestPage());
}
private void Button2_Clicked(object sender, EventArgs e)
{
Close(new TestPage());
}
private void Button3_Clicked(object sender, EventArgs e)
{
Close(new TestPage());
}
}
And the implementation:
private async void MenuButtonClicked(object sender, EventArgs e)
{
var popup = new PopupControl();
var result = await Application.Current.MainPage.ShowPopupAsync(popup);
if (result is ContentPage contentPageResult)
{
await Navigation.PushAsync(contentPageResult);
}
}