Skip to content

LinearGradientBrush GradientStop with Transparent Color is not transparent, but black #35477

Description

@mitschman

Description

The LinearGradientBrush GradientStop with Transparent Color is not transparent, but black

Steps to Reproduce

Prepare the LinearGradientBrush resources with Transparent Color GradientStop:

    <Color x:Key="Primary">#512BD4</Color>
    <LinearGradientBrush x:Key="PrimaryToTransparentRightToLeftGradientBrush" StartPoint="1,0" EndPoint="0,0">
        <GradientStop Color="{DynamicResource Primary}" Offset="0"/>
        <GradientStop Color="Transparent" Offset="1"/>
    </LinearGradientBrush>

and/or

    <Color x:Key="PrimaryDark">#ac99ea</Color>
    <LinearGradientBrush x:Key="PrimaryDarkToTransparentRightToLeftGradientBrush" StartPoint="1,0" EndPoint="0,0">
        <GradientStop Color="{DynamicResource PrimaryDark}" Offset="0"/>
        <GradientStop Color="Transparent" Offset="1"/>
    </LinearGradientBrush>

Place the Border on the colored page, set up the Background to the prepared brushes:

                                <Border HorizontalOptions="Start"
                                        Background="{AppThemeBinding Light={DynamicResource PrimaryToTransparentRightToLeftGradientBrush}, Dark={DynamicResource PrimaryDarkToTransparentRightToLeftGradientBrush}}"
                                        Stroke="Transparent" StrokeThickness="1">
                                    <Border.StrokeShape>
                                        <RoundRectangle CornerRadius="{Binding Settings.Layout.ToolsFrame.ItemMediaCornerRadius}" />
                                    </Border.StrokeShape>
                                    <Border.WidthRequest>
                                        <MultiBinding Converter="{StaticResource MultiMathExpressionConverter}" ConverterParameter="x0 * x1">
                                            <Binding Path="Width" x:DataType="Border" Source="{x:Reference MediaProgressControlRect}" />
                                            <Binding Path="CurrentMediaPlaybackProgress" FallbackValue="0" />
                                        </MultiBinding>
                                    </Border.WidthRequest>
                                </Border>

The 'transparent' places are black, not transparent:
Image

Note that the same code worked well on the version before (10.0.51):
Image

Link to public reproduction project repository

No response

Version with bug

10.0.60

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.50

Affected platforms

Android

Affected platform versions

Android 10.0 (API 29.0)

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-drawingShapes, Borders, Shadows, Graphics, BoxView, custom drawingi/regressionThis issue described a confirmed regression on a currently supported versionplatform/androidregressed-in-10.0.60s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions