3
So ändern Sie die Position des Titels in der Navigationsleiste in Xamarin-Form, von der Standardposition links in die Mitte oder rechts.So ändern Sie die Position des Titels in der Navigationsleiste
So ändern Sie die Position des Titels in der Navigationsleiste in Xamarin-Form, von der Standardposition links in die Mitte oder rechts.So ändern Sie die Position des Titels in der Navigationsleiste
You will need a custom render, here's how i have done it in IOS: (the thing is no way to you to get info from tamarin forms for the UIToolbarItem, so you can use the title to get the button u want or hardcode.
(this code, shows moving the 1st button to the left, leaving the other 2 buttons on the right) attached a screenshot
Create a custom PageRenderer to the page type where you want to access,
[assembly: ExportRenderer(typeof(CategoriesPage), typeof(CategoriesPageRenderer))]
and add
bool updatedButtons = false;
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear (animated);
if (!updatedButtons)
MoveButtonToLeft();
}
protected void MoveButtonToLeft()
{
var infoButton = NavigationController.TopViewController.NavigationItem.RightBarButtonItems[0];
NavigationController.TopViewController.NavigationItem.LeftBarButtonItem = infoButton;
var favButton = NavigationController.TopViewController.NavigationItem.RightBarButtonItems[1];
var musicButton = NavigationController.TopViewController.NavigationItem.RightBarButtonItems[2];
NavigationController.TopViewController.NavigationItem.RightBarButtonItems = new UIBarButtonItem[2] {favButton, musicButton };
updatedButtons = true;
}
Werfen Sie einen Blick auf 'CustomRenderers' https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/ –