Move your Xamarin.Forms Toolbar to the bottom on Windows
While iOS and Android typically have their toolbars and menus at the top of the page, on Windows you will find it at the bottom in most cases. Unfortunately, Xamarin.Forms renders all toolbar to the top of the page per default, even on Windows. So if you define a toolbar like this, it will appear at the top of the page, when running the Winows application, which is very uncommon there and might look strange to a Windows user.
Previously, you had to write a custom renderer, to modify the toolbar. Xamarin.Froms 2.3.3, which has faced its stable releasea couple of days ago,introduces Platform-Specifics, that can modify some UI elements for specificplatforms. The toolbar is one of them and we can attach a ToolbarPlacement to it with a single line of code.
public App() { MainPage = new NavigationPage(new MainPage()); MainPage.On<Xamarin.Forms.PlatformConfiguration.Windows>().SetToolbarPlacement(ToolbarPlacement.Bottom); }
However, these Platform-Specifics are still very limited, so we have to keep in mind that
- Toolbar Placement can only be set application wide, not per page
- Toolbar Placement can only be set on a `NavigationPage](http://pumpingco.de/content/images/2016/11/xamFormsBottomToolbar.png)
But it works and it is only one single line, that gives aXamarin.Forms app on Windows a way more natural look!