I have a content page with toolbar added as follows
ContentPage
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ChartList : ContentPage
{
public ChartList ()
{
InitializeComponent ();
//public class ToolbarItem : MenuItem
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 on the center of the toolbar. How to do it in Xamarin Forms?