Search code examples
c#wpfxamlopacitymask

Hide half of border with grid


How hide half of brush with opacity mask with no path element? I want to make site "transparent".

    <Border Height="32" Width="32" x:Name="b1" CornerRadius="50" BorderThickness="3" BorderBrush="Red">

    </Border>
    <Grid Height="32" Width="16" HorizontalAlignment="Right" x:Name="hideHaf" Background="Blue" >

    </Grid>

Default:

enter image description here

I want:

enter image description here


Solution

  • Just in case your primary goal is to draw a vertical half transparent circle. You could do it this way instead of using the Border:

        <Path Width="16" Height="32" Stretch="Fill" Data="M5,0 A5,5,0,0,0,5,10" Stroke="Red" StrokeThickness="3" HorizontalAlignment="Left" VerticalAlignment="Top"/>