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

[Bug] Shell FlyoutItem's Visual State "Disabled" does not work. #10296

Open
nhinze opened this issue Apr 10, 2020 · 5 comments
Open

[Bug] Shell FlyoutItem's Visual State "Disabled" does not work. #10296

nhinze opened this issue Apr 10, 2020 · 5 comments

Comments

@nhinze
Copy link

nhinze commented Apr 10, 2020

In my AppShell.xaml page I set a FlyoutItem to IsEnabled="False". I also setup a "Disabled" visual state. However, the background color does not change to red. The "Selected" visual sate works fine.

Xamarin.Forms 4.5.0.617
iOS SDK 13.4 - Simulator

<?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:views="clr-namespace:EventingVolunteers.Views"
       xmlns:volDash="clr-namespace:EventingVolunteers.Views.VolDash"
       xmlns:orgDash="clr-namespace:EventingVolunteers.Views.OrgDash"
       x:Class="EventingVolunteers.AppShell"
       FlyoutBackgroundColor="#337ab7">
    <Shell.Resources>
        <Style x:Key="FlyoutItemStyle" TargetType="Grid">
            <Setter Property="VisualStateManager.VisualStateGroups">
                <VisualStateGroupList>
                    <VisualStateGroup x:Name="CommonStates">
                        <VisualState x:Name="Normal" />
                        <VisualState x:Name="Selected">
                            <VisualState.Setters>
                                <Setter Property="BackgroundColor" Value="#2d6da4"/>
                            </VisualState.Setters>
                        </VisualState>
                        <VisualState x:Name="Disabled">
                            <VisualState.Setters>
                                <Setter Property="BackgroundColor" Value="Red"/>
                            </VisualState.Setters>
                        </VisualState>
                    </VisualStateGroup>
                </VisualStateGroupList>
            </Setter>
        </Style>
        <DataTemplate x:Key="FlyoutTemplates">
            <Grid HeightRequest="{x:OnPlatform Android=50}" Style="{StaticResource FlyoutItemStyle}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="{x:OnPlatform Android=54, iOS=50}"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Image Source="{Binding FlyoutIcon}"
                    VerticalOptions="Center"
                    HorizontalOptions="Center"
                    HeightRequest="{x:OnPlatform Android=24, iOS=22}"
                    WidthRequest="{x:OnPlatform Android=24, iOS=22}">
                </Image>
                <Label VerticalOptions="Center"
                        Text="{Binding Title}"
                        FontSize="{x:OnPlatform Android=14, iOS=Small}"
                        FontAttributes="Bold" Grid.Column="1">
                    <Label.TextColor>
                        White
                    </Label.TextColor>
                    <Label.Margin>
                        <OnPlatform x:TypeArguments="Thickness">
                            <OnPlatform.Platforms>
                                <On Platform="Android" Value="20, 0, 0, 0" />
                            </OnPlatform.Platforms>
                        </OnPlatform>
                    </Label.Margin>
                    <Label.FontFamily>
                        <OnPlatform x:TypeArguments="x:String">
                            <OnPlatform.Platforms>
                                <On Platform="Android" Value="sans-serif-medium" />
                            </OnPlatform.Platforms>
                        </OnPlatform>
                    </Label.FontFamily>
                </Label>
            </Grid>
        </DataTemplate>
    </Shell.Resources>
    <FlyoutItem x:Name="volFlyoutItem"
                Title="Volunteer Dashboard"
                FlyoutDisplayOptions="AsSingleItem"
                FlyoutIcon="ic_dashboard_white.png"
                Shell.ItemTemplate="{StaticResource FlyoutTemplates}">
        <ShellContent Title="Signups"
                      Icon="ic_assignment.png"
                      ContentTemplate="{DataTemplate volDash:SignupsPage}" />
        <ShellContent Title="Events"
                      Icon="ic_event.png"
                      ContentTemplate="{DataTemplate volDash:AreasPage}" />
        <ShellContent Title="Mailbox"
                      Icon="ic_mail_outline.png"
                      ContentTemplate="{DataTemplate volDash:MailboxPage}" />
        <ShellContent Title="Rankings"
                      Icon="fa_trophy.png"
                      ContentTemplate="{DataTemplate volDash:MyRankingsPage}" />
        <ShellContent Title="Videos"
                      Icon="ic_ondemand_video.png"
                      ContentTemplate="{DataTemplate volDash:TrainingVideoCategoriesPage}" />
    </FlyoutItem>
    <FlyoutItem x:Name="orgFlyoutItem"
                IsEnabled="False"
                Title="Organizer Dashboard"
                FlyoutDisplayOptions="AsSingleItem"
                FlyoutIcon="ic_dashboard_white.png"
                Shell.ItemTemplate="{StaticResource FlyoutTemplates}">
        <ShellContent Title="Events"
                      Icon="ic_event.png"
                      ContentTemplate="{DataTemplate orgDash:EventsPage}" />
    </FlyoutItem>
    <FlyoutItem
        x:Name="accountFlyoutItem"
        Title="Account"
        FlyoutDisplayOptions="AsSingleItem"
        FlyoutIcon="ic_account_box_white.png"
        Shell.ItemTemplate="{StaticResource FlyoutTemplates}">
        <ShellContent ContentTemplate="{DataTemplate views:AccountPage}" />
    </FlyoutItem>
    <FlyoutItem
        x:Name="aboutFlyoutItem"
        Title="About"
        FlyoutDisplayOptions="AsSingleItem"
        FlyoutIcon="ic_info.png"
        Shell.ItemTemplate="{StaticResource FlyoutTemplates}">
        <ShellContent ContentTemplate="{DataTemplate views:AboutPage}" />
    </FlyoutItem>
    <MenuItem
        Shell.MenuItemTemplate="{StaticResource FlyoutTemplates}"
        Text="Logout"
        Icon="ic_logout_white.png"
        Command="{Binding LogOutCommand}" />
</Shell>

Simulator_Screen_Shot_-iPhone_SE-_2020-04-10_at_13_11_11

@nhinze nhinze added s/unverified New report that has yet to be verified t/bug 🐛 labels Apr 10, 2020
@pauldipietro pauldipietro added this to New in Triage Apr 10, 2020
@samhouts samhouts added the a/VSM label Apr 17, 2020
@samhouts
Copy link
Member

@nhinze Can you please attach a small project that demonstrates this issue? Thanks!

@samhouts samhouts added s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Apr 17, 2020
@samhouts samhouts moved this from New to Needs Info in Triage Apr 17, 2020
@nhinze
Copy link
Author

nhinze commented Apr 18, 2020

Attached is the modified Xaminals project with a screenshot.

Simulator_Screen_Shot_-iPhone_SE-_2020-04-18_at_08_44_45

Xaminals.zip

@samhouts samhouts removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Apr 20, 2020
@samhouts samhouts moved this from Needs Info to New in Triage Apr 20, 2020
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Apr 21, 2020
@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Apr 21, 2020
@samhouts samhouts added this to Backlog in Shell May 11, 2020
@PureWeen PureWeen moved this from Backlog to To do (blockers) in Shell May 24, 2020
@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 13, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@Godfather95
Copy link

Any Updates when this is fixed?

@fotoguy42
Copy link

Any updates on this? I'm surprised more people don't have flyout items they want graphically differentiated when the item is disabled.

@acaliaro
Copy link

Hi guys, there is some news for this @jamesmontemagno @jfversluis @davidortinau

@PureWeen PureWeen removed their assignment Aug 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Shell
  
To do (blockers)
Triage
  
Needs Estimate
Development

No branches or pull requests

7 participants