title: How can I prevent WPF from clipping my image?
body: <p>I am writing a WPF app that displays an image that is initially centered. The user can zoom in/out and move the image, which are implemented using <code>ScaleTransform</code> and <code>TranslateTransform</code>. That works great.</p>
  
  <p>The problem is when the image is significantly bigger than the window, and the user moves the image or zooms out enough so that the entire image should be visible. The portion of the image that was originally hidden isn't rendered, and instead only the originally viewable part of the image is drawn.</p>
  
  <p>Based on some <a href="https://stackoverflow.com/questions/3686170/wpf-image-control-clipping">other</a> <a href="https://stackoverflow.com/questions/6010187/wpf-image-stretch-to-fill-doesnt-stretch-to-the-bounds-of-its-parents">questions</a>, if I put my image inside of a <code>Canvas</code> that will cause the entire image to be rendered, and when moved it will be rendered correctly. The problem is that I don't want my image to be in a <code>Canvas</code>, since that prevents any other layout from occurring - the <code>HorizontalAlignment</code> and <code>VerticalAlignment</code> properties are ignored (so the image is no longer centered), and I need to implement an option that will draw the image as large as possible to fill the entire area of the window which no longer works (setting the <code>Stretch</code> property to <code>UniformToFill</code> doesn't do anything).</p>
  
  <p>Currently the two transforms are set to the <code>RenderTransform</code> property. If I use <code>LayoutTransform</code> instead, the entire image is drawn, but this also prevents the user from moving any portion of the image off the edge of the window (which is behavior that I would like to keep).</p>
  
  <p>How can I tell WPF to always render the entire image without using a <code>Canvas</code> or a <code>LayoutTransform</code>?</p>