0

我想做类似这个例子的事情,但我做不到。我尝试了很多插件,但我找不到实现的方法。

有人知道或可以告诉我该怎么做吗?

当单击 MasterDetailPage 上的一个 ToolbarItem 时,我想显示一个显示弹出菜单。

我的实际应用程序:

在此处输入图像描述

我想要的是:

在此处输入图像描述

4

1 回答 1

0

我想你可以看看SlideOverKit

public SlideDownMenuView ()
{
    InitializeComponent ();

    // You must set HeightRequest in this case
    this.HeightRequest = 600;
    // You must set IsFullScreen in this case, 
    // otherwise you need to set WidthRequest, 
    // just like the QuickInnerMenu sample
    this.IsFullScreen = true;
    this.MenuOrientations = MenuOrientation.TopToBottom;

    // You must set BackgroundColor, 
    // and you cannot put another layout with background color cover the whole View
    // otherwise, it cannot be dragged on Android
    this.BackgroundColor = Color.FromHex ("#D8DDE7");         
}

否则在这里输入链接描述

您可以尝试使用此代码...

public partial class App : Application
{
    public App()
    {
        InitializeComponent();

        MasterDetailPage mdpage = new MasterDetailPage();
        mdpage.Master = new ContentPage() { Title = "Master", BackgroundColor = Color.Red };
        ToolbarItem tbi = new ToolbarItem() { Text = "POPUP" };
        tbi.Clicked += async (object sender, System.EventArgs e) => {

            StackLayout sl = new StackLayout() { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Start, BackgroundColor = Color.Pink, WidthRequest  = 100, HeightRequest = 200 };
            Rg.Plugins.Popup.Pages.PopupPage mypopup = new Rg.Plugins.Popup.Pages.PopupPage() {BackgroundColor = Color.Transparent };
            mypopup.Content = sl;
            await MainPage.Navigation.PushPopupAsync(mypopup);
        };
        ContentPage detail = new ContentPage() { Title = "Detail", BackgroundColor = Color.Green,  };
        detail.ToolbarItems.Add(tbi);
        mdpage.Detail = new NavigationPage(detail);
        MainPage = mdpage;
    }

    protected override void OnStart()
    {
        // Handle when your app starts
    }

    protected override void OnSleep()
    {
        // Handle when your app sleeps
    }

    protected override void OnResume()
    {
        // Handle when your app resumes
    }
}
于 2017-03-09T08:51:12.227 回答