【问题标题】:Xamarin App Shell - closing the flyout menu in codeXamarin App Shell - 在代码中关闭弹出菜单
【发布时间】:2021-02-18 18:09:22
【问题描述】:

我的应用程序设计要求我在 Flyout Header 中有一个按钮,这是一个单独的视图,用于导航到一个页面

与浮出控件本身不同,当我单击按钮时,页面会在保持打开状态的浮出控件标题下加载

有没有办法让按钮准确模拟在弹出内容本身中导航时发生的情况?

我尝试导航到的页面在 AppShell 中注册为路由

FlyoutHeader 中引用的视图中的代码像这样从按钮单击调用它

     await Shell.Current.GoToAsync("thepage");

如上所述,弹出菜单此时已打开以访问按钮,但单击时会加载所需的页面,但我希望它自动关闭菜单

请问有什么办法吗?

【问题讨论】:

  • 可以使用 Shell.Current.FlyoutIsPresented = false;
  • 里卡多做到了。 See here.

标签: xamarin.forms app-shell


【解决方案1】:

作为Ricardo says above.

你可以使用 Shell.Current.FlyoutIsPresented = false;

【讨论】:

    【解决方案2】:
     //===event click or command===
      
     private async void Button_Clicked(object sender, System.EventArgs e)
        {
            await Shell.Current.GoToAsync($"your others pages route");
            Shell.Current.FlyoutIsPresented = false;   
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-16
      • 1970-01-01
      • 1970-01-01
      • 2020-08-14
      • 1970-01-01
      • 1970-01-01
      • 2013-04-04
      • 1970-01-01
      相关资源
      最近更新 更多