Forum Xamarin Xamarin.Forms

how to set flyout selecteditem color to gradient in xamarin forms shell

udaysuddhalaudaysuddhala USMember ✭✭


is there anyway to set the selected flyout item color to gradient color in xamarin forms shell?


  • jezhjezh Member, Xamarin Team Xamurai
    edited June 22

    If you want to change the Flyoutitem background color, you can add a style of Item .

    In Shell.Resource

    <Style x:Key="FloutItemStyle" TargetType="Grid">
        <Setter Property="VisualStateManager.VisualStateGroups">
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="Selected">
                            <Setter Property="BackgroundColor" Value="Red"/>

    And use it in Shell.ItemTemplate

        <DataTemplate >
            <Grid Style="{StaticResource FloutItemStyle}">
                    <ColumnDefinition Width="0.2*" />
                    <ColumnDefinition Width="0.8*" />
                <Image Source="{Binding FlyoutIcon}"
            HeightRequest="45" />
                <Label Grid.Column="1"
            Text="{Binding Title}"
            VerticalTextAlignment="Center" />

    For Gradient Flyout, you can refer to this article:

  • udaysuddhalaudaysuddhala USMember ✭✭

    thanks @jezh . I did the same(visual state) to implement selected color, but i am unable to set gradient color to the item selected. we can set gradient color to the views . In this case , we have to get the selectedItem in the flyout and set its background color to some gradient color. i think it needs some cutom renderer for shell and should set it so. :( .

  • odaikurdodaikurd Member

    @jezh Thank You!

Sign In or Register to comment.