xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] Shell.Background not displaying gradient Brush #13066

Open davidortinau opened 3 years ago

davidortinau commented 3 years ago

Description

Screen Shot 2020-12-06 at 7 22 52 PM

Expected Behavior

The Shell.Background should take a gradient brush and display it in the navigation bar background.

Actual Behavior

Nothing is rendered, and it's white.

Screen Shot 2020-12-06 at 9 53 33 PM

Basic Information

Reproduction Link

https://github.com/davidortinau/Xappy

The gradient brush:

<Color x:Key="FlyoutGradientStart">#fd7b38</Color>
<Color x:Key="FlyoutGradientEnd">#ffc200</Color>

<LinearGradientBrush
      x:Key="FlyoutGradient"
      StartPoint="0,1"
      EndPoint="1,0">
        <GradientStop
            Color="{StaticResource FlyoutGradientEnd}"
            Offset="0" />
        <GradientStop
            Color="{StaticResource FlyoutGradientStart}"
            Offset="0" />
    </LinearGradientBrush>

Assigning to the Shell.Background:

<!-- SHELL -->
    <Style x:Key="BaseStyle"
           TargetType="Element">
        <Setter Property="Shell.Background"
                Value="{StaticResource FlyoutGradient}" />
        <Setter Property="Shell.ForegroundColor"
                Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
        <Setter Property="Shell.TitleColor"
                Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
        <Setter Property="Shell.DisabledColor"
                Value="#B4000000" />
        <Setter Property="Shell.UnselectedColor"
                Value="#CC0000" />
        <Setter Property="Shell.NavBarHasShadow"
                Value="False"/>
    </Style>

    <Style BasedOn="{StaticResource BaseStyle}"
           ApplyToDerivedTypes="True"
           TargetType="FlyoutItem" />
jsuarezruiz commented 3 years ago

Thanks for the detailed description, the issue will be fixed https://github.com/xamarin/Xamarin.Forms/pull/13090

Dwipraj commented 2 years ago

Hello, I have confusion regarding MAUI. Is <Setter Property="Shell.Background" Value="title_bar.png" /> valid if I want to set an image as the Background of "TitleBar"? If it's the correct approach then it's also not working.

PradoVargasN commented 2 years ago

@samhouts @davidortinau This is still not working on MAUI 6.0.536

Created, https://github.com/dotnet/maui/issues/10445