I am trying to create a rounded border and select its upper half. I use an ellipse with a radial gradient, overlapping the upper half of the border to highlight the selection, but I cannot figure out how to prevent the ellipse coloring the corners of the border. Here is a screenshot from Kaxaml:

And here is the XAML code:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="DarkGray"> <Grid Width="256" Height="256"> <Border CornerRadius="16" Background="Black" Margin="4"> <Border Background="Gray" Margin="32"> <TextBlock Foreground="Black" Text="1" FontFamily="Trebuchet MS" FontSize="96pt" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Border> </Border> <Border CornerRadius="16" ClipToBounds="True"> <Ellipse> <Ellipse.Fill> <RadialGradientBrush> <GradientStop Color="White" Offset="0"/> <GradientStop Color="Transparent" Offset="1"/> </RadialGradientBrush> </Ellipse.Fill> <Ellipse.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="3" ScaleY="2" CenterX="128" CenterY="128"/> <TranslateTransform Y="-235"/> </TransformGroup> </Ellipse.RenderTransform> </Ellipse> </Border> <Border CornerRadius="16" BorderThickness="8" BorderBrush="Black"/> </Grid> </Page>
How can I stop the upper corner areas affected by ellipse shading?
I tried playing with OpacityMask , but I have to admit that I donβt understand how to use it, especially with the conversion of the ellipse for rendering. No matter what I try, the ellipse either completely disappears or is not completely affected.
Any help would be greatly appreciated.
Thanks in advance.
source share