title: How is it possible that a WPF context menu is displayed outside the window?
body: <p>As I understand it, controls in WPF applications are not bound to system "window" resources (e.g., you can't find an handle for them with Spy++), unlike the old Windows Forms applications.</p>
  
  <p>So, how is that possible that part of those menus can be displayed <strong>outside</strong> the parent window? <strong>Why aren't they cut as soon as they reach the window borders?</strong></p>
  
  <p>One possibility, of course, is that they aren't really WPF menus but, instead, standard Windows resources. That, however, collides with the fact that I can style one of those menus exactly like any other WPF control, and some quick look at the system messages log seems to confirm that as far as Windows knows <strong>they are, in fact, the same exact resource</strong> with the same exact handle.</p>
  
  <p>Then, I went further. I applied a rotation to the menu:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type ContextMenu}"&gt;
      &lt;Setter Property="RenderTransformOrigin" Value="0.5,0.5" /&gt;
      &lt;Setter Property="RenderTransform"&gt;
          &lt;Setter.Value&gt;
              &lt;TransformGroup&gt;
                  &lt;ScaleTransform/&gt;
                  &lt;SkewTransform/&gt;
                  &lt;RotateTransform Angle="-18.435"/&gt;
                  &lt;TranslateTransform/&gt;
              &lt;/TransformGroup&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>And this is the rather interesting result:</p>
  
  <p><img src="https://i.stack.imgur.com/fnAVM.png" alt="Menu gets clipped in a rectangle"></p>
  
  <p>So, what's going on?</p>