如何自定义xamarin形式的UWP顶部栏

问题描述 投票:0回答:1

我正在尝试将工具栏作为该图像(应用程序顶部栏:]

enter image description here

我想添加按钮,取消并保存,如上图所示。我正在尝试使用ToolbarItems进行此操作,但是我得到的按钮实际上是“下拉菜单”。

enter image description here

有什么方法可以使其成为第一张图片?谢谢。

xamarin.forms uwp uwp-xaml xamarin.uwp
1个回答
1
投票

如sermet所述,您可以使用NavigationPage.TitleView,用法非常简单。

  <NavigationPage.TitleView>
    <Grid HorizontalOptions="FillAndExpand">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="100"/>
        </Grid.ColumnDefinitions>

        <Button Text="Cancel" />
        <Label Text="Example Title" FontSize="Large" Grid.Column="1" HorizontalTextAlignment="Center"/>
        <Button Text="Save" Grid.Column="2"/>
    </Grid>
</NavigationPage.TitleView>

enter image description here

更新

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.