如何使用 Xamarin.Forms 将导航按钮添加到 header onMaster 详细信息页面
How to add Navigation buttons to the header onMaster Detail Page with Xamarin.Forms
我正在尝试使用 Xamarin Forms 创建与 Google Plus 应用程序 (iOS) 中类似的 header。
我已经让左侧菜单(抽屉)按预期工作,但我无法找到添加更多按钮(如搜索循环图标)和正下方的选项卡式/幻灯片页面的方法。
我对底部的标签式菜单不感兴趣,只需要右侧的循环图标和 3 个标签式菜单(推荐、会员和您的)。
我应该将此添加到主详细信息页面 child 的每个页面,还是以某种方式转到主详细信息页面。我想不通。
谢谢
对于顶部的搜索选项,您只需在页面中添加 ToolbarItem
:
<ContentPage ...>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Search" Icon="MySearchIcon.png" Order="Primary"
Command="{Binding SearchCommandBinding}" />
...
</ContentPage.ToolbarItems>
<!-- Here are your UI Elements -->
</ContentPage>
对于您的 TabbedPage...是的,这也是您的答案。您可以使用 Xamarin 中的 TabbedPage(而不是 ContentPage 或您使用的任何内容)。
只需将 MasterDetailPage
中的 Detail
设置为 TabbedPage 即可。
或者,您可以只添加 Grid and design it like a Tabs. With this, you have the same UI over all platforms (more infos ).
我正在尝试使用 Xamarin Forms 创建与 Google Plus 应用程序 (iOS) 中类似的 header。 我已经让左侧菜单(抽屉)按预期工作,但我无法找到添加更多按钮(如搜索循环图标)和正下方的选项卡式/幻灯片页面的方法。
我对底部的标签式菜单不感兴趣,只需要右侧的循环图标和 3 个标签式菜单(推荐、会员和您的)。
我应该将此添加到主详细信息页面 child 的每个页面,还是以某种方式转到主详细信息页面。我想不通。
谢谢
对于顶部的搜索选项,您只需在页面中添加 ToolbarItem
:
<ContentPage ...>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Search" Icon="MySearchIcon.png" Order="Primary"
Command="{Binding SearchCommandBinding}" />
...
</ContentPage.ToolbarItems>
<!-- Here are your UI Elements -->
</ContentPage>
对于您的 TabbedPage...是的,这也是您的答案。您可以使用 Xamarin 中的 TabbedPage(而不是 ContentPage 或您使用的任何内容)。
只需将 MasterDetailPage
中的 Detail
设置为 TabbedPage 即可。
或者,您可以只添加 Grid and design it like a Tabs. With this, you have the same UI over all platforms (more infos