WPF inner shadow on border element

Here’s a technique which I came across today on Timo Pijnappel’s Daily Development Blog which does what the title of this post says it should.

And here’s the code:

<Grid Grid.ColumnSpan="3" Grid.RowSpan="5">
    <Border Background="{StaticResource brshBody}" BorderBrush="White" BorderThickness="0,2,2,0" CornerRadius="0,10,0,0" x:Name="Mask"/>
    <Grid>
        <Grid.OpacityMask>
            <VisualBrush Visual="{Binding ElementName=Mask}"/>
        </Grid.OpacityMask>
        <Border CornerRadius="0,10,0,0" BorderThickness="0,2,2,0" Margin="0" BorderBrush="White" ClipToBounds="True">
            <Border.Effect>
                <DropShadowEffect BlurRadius="7" Color="Black" Direction="0" ShadowDepth="0" />
            </Border.Effect>
        </Border>
    </Grid>
</Grid>

Book a FREE Consultation Today

Pick a day & time in the calendar that suits you for a 30 minute phone, video or in-person* meeting to run through your needs and explore options.

Please include a brief summary of your request along with any existing links, etc.

* In-person visits available in the Isle of Purbeck, Dorset and surrounding areas only