I have a content page with a toolbar added as shown below.
Contentpage
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ChartList : ContentPage
{
public ChartList ()
{
InitializeComponent ();
ToolbarItem settings = new ToolbarItem
{
Icon = "icon.png",
Text = "Settings",
Command = new Command(this.ShowHomePage),
};
this.ToolbarItems.Add(settings);
}
private void ShowHomePage()
{
this.Navigation.PushAsync(new MainPage());
}
}
App.xaml.cs
public App()
{
InitializeComponent();
ContentPage p = new MyHomeScreen2.MainPage();
MainPage = new NavigationPage(p)
{
BarBackgroundColor = Color.Purple,
BarTextColor = Color.White
};
}
I need to align the icon in the center of the toolbar. How to do this in Xamarin forms?

source
share