Shape Exclude

image_pdfimage_print


   
     
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="Microsoft.Samples.Graphics.RectangleExample"
    Title="Example">
  <Window.Resources>
    <RectangleGeometry x:Key="rect" Rect="0 0 100 100"></RectangleGeometry>
    <EllipseGeometry x:Key="ellipse" Center="85 50" RadiusX="65" RadiusY="35"></EllipseGeometry>
  </Window.Resources>    
  <Canvas>
      <Path Grid.Row="3" Fill="Yellow" Stroke="Blue" Margin="5">
        <Path.Data>
          <CombinedGeometry GeometryCombineMode="Exclude"
            CombinedGeometry.Geometry1="{StaticResource rect}"
            CombinedGeometry.Geometry2="{StaticResource ellipse}">
          </CombinedGeometry>                  
        </Path.Data>
      </Path>
      <TextBlock Margin="10" VerticalAlignment="Center">Exclude</TextBlock>
      

  </Canvas>
</Window>