Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I know that this isn't an answer to the initial question ... but you often want to clip the inner content of that rounded corner border you just created.</p> <p>Chris Cavanagh has come up with an <a href="http://chriscavanagh.wordpress.com/2008/10/03/wpf-easy-rounded-corners-for-anything/" rel="noreferrer">excellent way</a> to do just this.</p> <p>I have tried a couple different approaches to this ... and I think this one rocks.</p> <p>Here is the xaml below:</p> <pre><code>&lt;Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="Black" &gt; &lt;!-- Rounded yellow border --&gt; &lt;Border HorizontalAlignment="Center" VerticalAlignment="Center" BorderBrush="Yellow" BorderThickness="3" CornerRadius="10" Padding="2" &gt; &lt;Grid&gt; &lt;!-- Rounded mask (stretches to fill Grid) --&gt; &lt;Border Name="mask" Background="White" CornerRadius="7" /&gt; &lt;!-- Main content container --&gt; &lt;StackPanel&gt; &lt;!-- Use a VisualBrush of 'mask' as the opacity mask --&gt; &lt;StackPanel.OpacityMask&gt; &lt;VisualBrush Visual="{Binding ElementName=mask}"/&gt; &lt;/StackPanel.OpacityMask&gt; &lt;!-- Any content --&gt; &lt;Image Source="http://chriscavanagh.files.wordpress.com/2006/12/chriss-blog-banner.jpg"/&gt; &lt;Rectangle Height="50" Fill="Red"/&gt; &lt;Rectangle Height="50" Fill="White"/&gt; &lt;Rectangle Height="50" Fill="Blue"/&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/Page&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload