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>