Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Shell] No styling properties for ShellItem or MenuItem #4509

Closed
davidortinau opened this issue Nov 21, 2018 · 12 comments
Closed

[Shell] No styling properties for ShellItem or MenuItem #4509

davidortinau opened this issue Nov 21, 2018 · 12 comments

Comments

@davidortinau
Copy link
Contributor

davidortinau commented Nov 21, 2018

Description

There are some appearance styles available for tabs and other shell items, but nothing for the items that appear in the flyout.

https://github.com/xamarin/Xamarin.Forms/blob/shell-3.4.0/Xamarin.Forms.Core/Shell.cs#L80

For the flyout all we have is FlyoutBackgroundColor. Would like:

  • icon color
  • label color
  • background color
  • selected background color
  • disabled background color

Additionally there's a separator between ShellItems and MenuItems that needs to be styled or hidden.

Also see #4399 about mixing Shell and Menu items.

APIS

public class ShellSection/ShellContent

// These apply to the tab 
		public static readonly BindableProperty TitleColorProperty		
		public static readonly BindableProperty TitleUnselectedColorProperty			
		public static readonly BindableProperty BackgroundColorProperty		
		public static readonly BindableProperty BackgroundColorUnselectedProperty
		public static readonly BindableProperty IconColor
		public static readonly BindableProperty IconUnselectedColor

// These apply when the element is used as a flyout
		public static readonly BindableProperty FlyoutTitleColorProperty		
		public static readonly BindableProperty FlyoutTitleUnselectedColorProperty			
		public static readonly BindableProperty FlyoutBackgroundColorProperty		
		public static readonly BindableProperty FlyoutBackgroundColorUnselectedProperty
		public static readonly BindableProperty FlyoutIconUnselectedColor
public class ShellItem

// These apply to the Flyout
		public static readonly BindableProperty TitleColorProperty		
		public static readonly BindableProperty TitleUnselectedColorProperty			
		public static readonly BindableProperty BackgroundColorProperty		
		public static readonly BindableProperty BackgroundColorUnselectedProperty
		public static readonly BindableProperty IconColor
		public static readonly BindableProperty IconUnselectedColor

Screenshots

screen shot 2018-11-21 at 4 53 48 pm

screen shot 2018-11-21 at 4 41 58 pm

Repro

<?xml version="1.0" encoding="UTF-8"?>
<Shell xmlns="http://xamarin.com/schemas/2014/forms" 
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
       xmlns:local="clr-namespace:Gastropod"
       Route="gastropods"
       RouteHost="www.xamarin.com"
       RouteScheme="app"
       FlyoutBackgroundColor="Teal"
       BackgroundColor="Red"
       Title="Gastropods"
       x:Class="Gastropod.Shell">
    
    <Shell.FlyoutHeader>
        <ContentView HeightRequest="300">
            <Label Text="Gastropods" FontSize="48" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
        </ContentView>
    </Shell.FlyoutHeader>
    
    <Shell.MenuItems>
        <MenuItem Text="A Menu Item" />
        <MenuItem Text="Anothing Menu Item" />
    </Shell.MenuItems>
    
    <ShellItem FlyoutIcon="iconXamarin.png" Title="Home">
        <ShellContent Route="home" ContentTemplate="{DataTemplate local:MainPage}"/>
    </ShellItem>
    
    <ShellItem FlyoutIcon="iconXamarin.png" Title="Feed">
        <ShellContent Route="feed" ContentTemplate="{DataTemplate local:FeedPage}"/>
    </ShellItem>

    <ShellItem Route="tabsandwich" Title="Tab Sandwich" FlyoutIcon="iconXamarin.png">
        <ShellSection Route="activity" Title="Activity" Icon="iconXamarin.png">
            <ShellContent Route="shared" Title="Shared" ContentTemplate="{DataTemplate local:ActivityPage}" />
            <ShellContent Route="notifications" Title="Notifications" ContentTemplate="{DataTemplate local:NotificationsPage}" />
        </ShellSection>
        <ShellSection Route="updates" Title="Updates" Icon="iconXamarin.png">
            <ShellContent Route="updates" Title="Updates" Icon="iconXamarin.png" ContentTemplate="{DataTemplate local:UpdatesPage}" />
            <ShellContent Route="home" Title="Home" Icon="iconXamarin.png" ContentTemplate="{DataTemplate local:MainPage}" />
        </ShellSection>
    </ShellItem>
    
    <ShellItem Route="single" Title="Single Page" FlyoutIcon="iconXamarin.png">
        <ShellContent Route="home" Title="Home" Icon="iconXamarin.png" ContentTemplate="{DataTemplate local:MainPage}" />
    </ShellItem>
    
    <ShellItem Route="toptabs" Title="Top Tabs" FlyoutIcon="iconXamarin.png">
        <ShellSection Route="activity" Title="Activity" Icon="iconXamarin.png" >
            <ShellContent Route="shared" Title="Shared" ContentTemplate="{DataTemplate local:ActivityPage}" />
            <ShellContent Route="notifications" Title="Notifications" ContentTemplate="{DataTemplate local:NotificationsPage}" />
        </ShellSection>
    </ShellItem>
    
    <ShellItem Route="bottomtabs" Title="Bottom Tabs" FlyoutIcon="iconXamarin.png">
        <ShellSection Route="home" Title="Home" Icon="home.png">
            <ShellContent ContentTemplate="{DataTemplate local:MainPage}" />
        </ShellSection>
        <ShellSection Route="activity" Title="Activity" Icon="iconXamarin.png" >
            <ShellContent ContentTemplate="{DataTemplate local:ActivityPage}" />
        </ShellSection>
        <ShellSection Route="updates" Title="Updates" Icon="iconXamarin.png">
            <ShellContent ContentTemplate="{DataTemplate local:UpdatesPage}" />
        </ShellSection>
        <ShellSection Route="feed" Title="Feed" Icon="iconXamarin.png">
            <ShellContent ContentTemplate="{DataTemplate local:FeedPage}" />
        </ShellSection>
    </ShellItem>
</Shell>

Parent: #2415

@davidortinau
Copy link
Contributor Author

Perhaps would be nice to set both a template and a style on each ShellItem or MenuItem if I want to control them individually.

@samhouts samhouts added this to the 3.5.0 milestone Dec 4, 2018
@samhouts samhouts modified the milestones: 3.5.0, 4.0.0 Jan 10, 2019
@davidortinau davidortinau added the blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. label Mar 14, 2019
@samhouts samhouts added the e/5 🕔 5 label Mar 25, 2019
@samhouts samhouts removed this from the 4.0.0 milestone Apr 22, 2019
@samhouts samhouts added m/high impact ⬛ and removed blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. labels Apr 22, 2019
@samhouts samhouts added the inactive Issue is older than 6 months and needs to be retested label May 21, 2019
@cwarnke
Copy link

cwarnke commented Jun 19, 2019

I would absolutely like the ability to at least style the title font. I don't believe this is currently possible? I just had a request to change the font family of the FlyoutItem Title.

@wagenheimer
Copy link

Why this bug is Inactive? I need some workaround for it.

@jeremymarabel
Copy link

Hi ! This feature would be awesome, any estimation or workaround available ?

@petzasc
Copy link

petzasc commented Jul 18, 2019

Being able to see that a tab is disabled seems important. Currently you see the tab if IsEnabled=False, but nothing happens when you tap on it. (You can with Shell.ItemTemplate)

@rapcgutz
Copy link

rapcgutz commented Aug 1, 2019

Any workaround on this?

@igor-eremyashev
Copy link

+1 for this issue. It would be nice to have the same properties (disabled/default/selected background/foreground color) for both Flyout and TabBar (as I understand, TabBar uses TitleColor as foreground color). Also I cannot find any property that can tell that the ShellItem is currently selected. It would certainly help to write custom item templates.

@Pinox
Copy link

Pinox commented Aug 27, 2019

plse also add a way to change the Hamburger menu color.

menu color

@anotherlab
Copy link

+1 For this. We need the ability to make a disabled ShellItem appear as disabled.

@SirJohnK
Copy link

+1. Ability to hide and/or set color on separator between ShellItems and MenuItems.

@PureWeen PureWeen changed the title [Shell] No styling properties for ShellItem or MenuItem displayed in Flyout [Shell] No styling properties for ShellItem or MenuItem Nov 23, 2019
@samhouts samhouts added this to the 4.5.0 milestone Jan 6, 2020
@PureWeen
Copy link
Contributor

PureWeen commented Jan 8, 2020

@davidortinau I think these should all be moved to attached properties and be a little less implicit. For example

Shell.FlyouotTitleColorProperty
Shell.TitleColorProperty
Shell.TabTitleColorProperty
Shell.TopTabTitleColorProperty
Shell.BottomTabTitleColorProperty

thoughts?

@samhouts samhouts added proposal-open and removed inactive Issue is older than 6 months and needs to be retested labels Feb 6, 2020
@samhouts samhouts removed this from the 4.5.0 milestone Feb 11, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Mar 26, 2020
@samhouts
Copy link
Member

samhouts commented May 1, 2020

closed by #9886

@samhouts samhouts closed this as completed May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests