I need to have关闭button(在本例中)在左侧 of 导航栏, 如下。我只需要弹出窗口,因此其他元素/导航不存在潜在问题。
谷歌对此有一些建议,但我只看到了 iOS 示例(这并不是一个需要处理的大问题)iOS custom renderer
),但没有提示如何处理它(easily) with Android.
只是为了清楚起见,它需要它Xamarin.Forms
定义与此类似(或代码隐藏):
<ContentPage.ToolbarItems>
<ToolbarItem Text="X" Priority="-1" Command="{Binding GoCancel}"/>
<ToolbarItem Icon="icon_save" Command="{Binding GoSave}"/>
</ContentPage.ToolbarItems>
有什么想法吗?
使用 Xamarin Forms 3.2,有一种处理更复杂场景的新方法NavigationBar
。它被称为TitleView
.
有了这个你可以推动任何View
你想要NavigationBar
.
XAML 示例:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="NavigationPageTitleView.TitleViewPage">
<NavigationPage.TitleView>
<Slider HeightRequest="44" WidthRequest="300" />
</NavigationPage.TitleView>
...
</ContentPage>
有关它的更多信息请点击此处https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/hierarchical#displaying-views-in-the-navigation-bar https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/hierarchical#displaying-views-in-the-navigation-bar示例项目可以在这里找到https://developer.xamarin.com/samples/xamarin-forms/Navigation/TitleView/ https://developer.xamarin.com/samples/xamarin-forms/Navigation/TitleView/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)