Skip to content

Instantly share code, notes, and snippets.

@srsivaprasad
Last active October 24, 2016 11:51
Show Gist options
  • Save srsivaprasad/f1d6c806b21207234586c905b7050708 to your computer and use it in GitHub Desktop.
Save srsivaprasad/f1d6c806b21207234586c905b7050708 to your computer and use it in GitHub Desktop.
Custom Navigation Renderer for removing the icon from action bar for xamarin forms
[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
namespace Example
{
public class RootNavigationRenderer : NavigationRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
RemoveAppIconFromActionBar();
}
void RemoveAppIconFromActionBar()
{
var actionBar = ((Activity)Context).ActionBar;
actionBar.SetIcon(new ColorDrawable(Color.Transparent.ToAndroid()));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment