Prism Xamarin Forms ToolbarItem出现两次 [英] Prism Xamarin Forms ToolbarItem appearing twice

查看:126
本文介绍了Prism Xamarin Forms ToolbarItem出现两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Prism进行Xamarin Forms应用程序开发.

I am using Prism for Xamarin Forms application development.

可能是因为我对Prism和Xamarin Froms都不陌生,因此我正面临导航方面的一个基本问题.

May be because I am new to both Prism and Xamarin Froms because of which I am facing a basic issue with the navigation.

让我从实施的细节开始,然后是眼前的问题.

Let me start with the details of my implementation and then the issue at hand.

  1. 我有一个MasterDetail页面(名为Home),这是我的主页. 母版页中有一些菜单项.合作伙伴就是其中之一.
  2. 在伙伴"菜单项上单击时,将调用NavigationService.NavigateAsync("Navigation/Partner")方法.其中"NavigationService"的类型为"INavigationService".
  3. 这将打开一个名为"Partner"的页面,该页面是一个选项卡式页面(TabbedPage).第一个标签是一个名为"PartnerAll"的内容页面.
  4. PartnerAll页面包含一个列表视图.单击列表视图项后,将通过调用NavigationService.NavigateAsync("Navigation/PartnerDetails",parameter,false,true)打开一个新页面"PartnerDetails";
  5. 在PartnerDetails页面上,我添加了一个名为取消"的工具栏项.
  1. I have a MasterDetail Page (named Home) which is my main page. There are a few menu items in the Master Page. One of them is Partner.
  2. On Click of Partner menu item, NavigationService.NavigateAsync("Navigation/Partner") method is called. Where "NavigationService" is of type "INavigationService".
  3. This opens a page called "Partner" which is a tabbed page (TabbedPage). The first tab is a contentpage called "PartnerAll".
  4. PartnerAll page contains a listview. On click of a list view item, a new page is opened "PartnerDetails" by calling NavigationService.NavigateAsync("Navigation/PartnerDetails", parameters, false, true);
  5. On PartnerDetails page, I have added a toolbaritem called "Cancel".

问题:当打开"PartnerDetails"页面时,取消"项目显示两次,如屏幕截图所示: 带有两个取消按钮的合作伙伴详细信息页面的屏幕截图

Issue: When "PartnerDetails" page opens up, "Cancel" item shows up twice, as shown in the screenshot: screenshot of partner details page with two cancel buttons

我要去哪里了?我应该怎么做才能使其正常工作?

Where is it I am going wrong. What should I do to make it work?

请协助.

最好的问候,Ankur Jain

Best regards, Ankur Jain

推荐答案

您应该只传递目标页面的标识符字符串,而不是将NavigationPage的另一个实例压入堆栈

You should just pass in the identifier string for your destination page, instead of pushing another instance of the NavigationPage onto the stack

这样做NavigationService.NavigateAsync(PartnerDetails);

这篇关于Prism Xamarin Forms ToolbarItem出现两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆