简体   繁体   English

Xamarin.Forms Shell页面中导航栏中如何显示view

[英]How to display views in the navigation bar in Xamarin.Forms Shell pages

How to display views in the navigation bar in Xamarin.Forms Shell pages?如何在Xamarin.Forms Shell页面的导航栏显示view?

menu screenshot菜单截图

The MainPage starts with like this: MainPage 以这样的方式开始:

MainPage = new AppShell();

The Shell.TitleView attached property, of type View, enables any View to be displayed in the navigation bar. View 类型的Shell.TitleView附加属性使任何View都可以显示在导航栏中。

While this property can be set on a subclassed Shell object, it can also be set on any pages that want to display a view in the navigation bar.虽然可以在子类Shell object 上设置此属性,但也可以在要在导航栏中显示视图的任何页面上设置它。 For example, the following XAML shows displaying a Label in the navigation bar:例如下面的 XAML 表示在导航栏中显示一个Label

    <Shell.TitleView>
        <Label>title here </Label>
    </Shell.TitleView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM