user3079834
user3079834

Reputation: 2214

WP8.1 transparent gradient

if I use the linear gradient this way in WP 8.1:

<Grid Height="20">
  <Grid.Background>
     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="Transparent" Offset="0"/>
        <GradientStop Color="Black" Offset="1"/>
     </LinearGradientBrush>
  </Grid.Background>
</Grid>

I get a picture like this:

linear Gradient

When I understand it right, this is due to a deficient in alpha value transition. For Windows XAML there are MarkupExtensions, that fix this issue, however for WindowsPhone I cannot use MarkupExtensions.

Is there another solid workaround, that satisfies my needs for this?

(and yes, it should be transparent, as it should fade out a Scrollbar on the Bottom and this Scrollbar has content of different colors. Usually I can just trick around by making the "transparent" color just the color of the surrounding.)

Upvotes: 1

Views: 467

Answers (1)

sibbl
sibbl

Reputation: 3229

Okay so I guess the problem is the white color...?

The problem is that Transparent is the same as #FFFFFF with full transparency, so in ARGB notation #00FFFFFF. What you want is a fully transparent #000000, so in ARGB notation this is #00000000.

Using ARGB notation, I guess this is what you are looking for:

<Grid Height="20">
  <Grid.Background>
     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#00000000" Offset="0"/>
        <GradientStop Color="#ff000000" Offset="1"/>
     </LinearGradientBrush>
  </Grid.Background>
</Grid>

Upvotes: 2

Related Questions