【问题标题】:Move Toolbar to the bottom in UWP with PlatformConfiguration (Xamarin.Forms 2.3.3)使用 PlatformConfiguration (Xamarin.Forms 2.3.3) 在 UWP 中将工具栏移动到底部
【发布时间】:2023-03-16 12:35:02
【问题描述】:

Xamarin.Forms 2.3.3.166-pre4 中尝试新的 PlatformConfiguration,但在 UWP 上将工具栏移动到底部只是不想工作。我做错了什么?

using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;

namespace FormsToolBarDemo
{
    public partial class MainPage:ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            this.On<Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom);
        }
    }
}

【问题讨论】:

    标签: xamarin xamarin.forms uwp xamarin.uwp


    【解决方案1】:

    好吧,在尝试了SetToolbarPlacement(ToolbarPlacement.Bottom)的所有可能组合之后,我发现了一些东西:

    • 工具栏位置只能在应用程序范围内设置,不能在每页设置
    • 工具栏位置只能设置在NavigationPage

    所以你可以做什么,当你想把工具栏放在底部时,你可以通过将工具栏放置附加到AppMainPage属性来设置它的应用程序范围。

    public App()
    {
        MainPage = new NavigationPage(new MainPage());
        MainPage.On<Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-20
      • 2019-01-15
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      相关资源
      最近更新 更多