Share via


Platzierung der Seitensymbolleiste unter Windows

Diese Universelle Windows-Plattform plattformspezifisch wird verwendet, um die Platzierung einer Symbolleiste in einem PageXaml-Code zu ändern und wird in XAML verwendet, indem die Page.ToolbarPlacement angefügte Eigenschaft auf einen Wert der ToolbarPlacement Enumeration festgelegt wird:

<TabbedPage ...
            xmlns:windows="clr-namespace:Xamarin.Forms.PlatformConfiguration.WindowsSpecific;assembly=Xamarin.Forms.Core"
            windows:Page.ToolbarPlacement="Bottom">
  ...
</TabbedPage>

Alternativ kann es auch von C# aus über die Fluent-API genutzt werden:

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

page.On<Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom);

Die Methode Page.On<Windows> legt fest, dass dies plattformspezifisch ist und nur unter Windows ausgeführt wird. Die Page.SetToolbarPlacement Methode im Xamarin.Forms.PlatformConfiguration.WindowsSpecific Namespace wird verwendet, um die Symbolleistenplatzierung festzulegen, wobei die ToolbarPlacement Enumeration drei Werte bereitstellt: Default, , Topund Bottom.

Das Ergebnis ist, dass die angegebene Symbolleistenplatzierung auf die Page Instanz angewendet wird:

Plattformspezifische Symbolleistenplatzierung