A Microsoft platform for building and publishing apps for Windows devices.
LinearGradientBrush Repeat SpreadMethod turns foreground UIElements transparent
Paul Hansen
1
Reputation point
Using a LinearGradientBrush with a SpreadMethod of Repeat causes foreground elements to become transparent:
<StackPanel Margin="10">
<Grid Width="100" Height="100">
<Grid.Background>
<LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" EndPoint="20,10">
<GradientStop Offset="4" Color="Blue" />
<GradientStop Color="Red" />
</LinearGradientBrush>
</Grid.Background>
<Rectangle Margin="10" Fill="White" />
</Grid>
<Grid Width="100" Height="100">
<Grid.Background>
<LinearGradientBrush MappingMode="Absolute" SpreadMethod="Pad" EndPoint="20,10">
<GradientStop Offset="4" Color="Blue" />
<GradientStop Color="Red" />
</LinearGradientBrush>
</Grid.Background>
<Rectangle Margin="10" Fill="White" />
</Grid>
</StackPanel>
I found this StackOverflow question with the same issue (simplified it for my example), but no workarounds listed.
(Running Win 10 20H2, OS Build 19042.685)
Developer technologies | Universal Windows Platform (UWP)
Developer technologies | Universal Windows Platform (UWP)
Sign in to answer