Windows 上的頁面工具列位置
這個 通用 Windows 平台 平臺專用可用來變更 工具列在 上Page
的位置,並將附加屬性設定Page.ToolbarPlacement
為 列舉值ToolbarPlacement
,以在 XAML 中使用:
<TabbedPage ...
xmlns:windows="clr-namespace:Xamarin.Forms.PlatformConfiguration.WindowsSpecific;assembly=Xamarin.Forms.Core"
windows:Page.ToolbarPlacement="Bottom">
...
</TabbedPage>
或者,您可以使用 Fluent API 從 C# 取用它:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;
...
page.On<Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom);
方法 Page.On<Windows>
會指定這個平臺專用只會在 Windows 上執行。 命名空間 Page.SetToolbarPlacement
中的 Xamarin.Forms.PlatformConfiguration.WindowsSpecific
方法可用來設定工具列位置,而 ToolbarPlacement
列舉提供三個值: Default
、 Top
和 Bottom
。
結果是指定的工具列位置會套用至 Page
實例: