Based on @TheRealJasonSmith's gist on how to add Material design to your Forms.Android app, I've implemented the "Toolbar" instead of the "ActionBar".
I'm wondering how I might go about getting access to that View in order to set the NavigationIcon
to the Page.Icon
?
Right now I've got a custom renderer that is attempting to set the Toolbar NavigationIcon
like so, but toolbar is always null
[assembly: ExportRenderer(typeof(Page), typeof(Renderers.ExtendedPageRenderer))]
namespace Renderers
{
public class ExtendedPageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
{
base.OnElementChanged(e);
if (Element != null && Element.Icon != null)
{
var iconId = ResourceManager.GetDrawableByName(Element.Icon.File);
var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
if (toolbar != null)
{
toolbar.SetNavigationIcon(iconId);
}
}
}
}
}