Reputation: 3980
I am trying to disable the hamburger icon is there a way to do that using shell I tried setting the following but it still appears in the simulator.
I want the flyout effect to still happen but I don't want the Hambugger icon their.
<Shell.Resources>
<ResourceDictionary>
<Color x:Key="NavigationPrimary">#2196F3</Color>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
<Setter Property="Shell.TabBarTitleColor" Value="White"/>
</Style>
<Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
</ResourceDictionary>
</Shell.Resources>
<Shell.FlyoutHeader>
<Grid BackgroundColor="Black">
<Label Text="Test"
TextColor="White"
FontAttributes="Bold"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center" />
</Grid>
</Shell.FlyoutHeader>
<FlyoutItem Title="Collect Data" >
<Tab>
<ShellContent Title="Configuration"
ContentTemplate="{DataTemplate local:AboutPage}" />
<ShellContent Title="Collect Data"
ContentTemplate="{DataTemplate local:ItemsPage}" />
</Tab>
</FlyoutItem>
<FlyoutItem Title="About">
<ShellContent ContentTemplate="{DataTemplate local:AboutPage}" />
</FlyoutItem>
Upvotes: 1
Views: 185
Reputation: 10978
Try to set the BackgroundColor of shell to White, it would hide the hamburger icon.
<Shell
....
BackgroundColor="White"
....>
Or you could use the custom renderer to reset the toolbar background color to white. It would hide the icon as well.
[assembly: ExportRenderer(typeof(AppShell), typeof(MyShellRenderer))]
namespace ShellDemo2.Droid
{
public class MyShellRenderer : ShellRenderer
{
public MyShellRenderer(Context context) : base(context)
{
}
protected override IShellToolbarAppearanceTracker CreateToolbarAppearanceTracker()
{
return new MyToolbarAppearanceTracker(this);
}
protected override IShellTabLayoutAppearanceTracker CreateTabLayoutAppearanceTracker(ShellSection shellSection)
{
return new MyTabLayoutAppearanceTracker(this);
}
}
public class MyToolbarAppearanceTracker : IShellToolbarAppearanceTracker
{
private MyShellRenderer myShellRenderer;
public MyToolbarAppearanceTracker(MyShellRenderer myShellRenderer)
{
this.myShellRenderer = myShellRenderer;
}
public void Dispose()
{
}
public void ResetAppearance(Android.Support.V7.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker)
{
toolbar.SetBackgroundColor(Android.Graphics.Color.White);
}
public void SetAppearance(Android.Support.V7.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker, ShellAppearance appearance)
{
}
}
}
Upvotes: 2