title: How do I scale path geometry to fit a viewbox without scaling the line width?
body: <p>I want to draw a user control with content displayed.  Essentially I want a custom box around whatever the content is.</p>
  
  <p>I want that box to scale, so I am using a viewbox.  Unfortunately, the viewbox transforms the entire displayed control, not just the geometry of the box.  This leads to the lines used for the border to be stretched.</p>
  
  <p>Here is my control that I need to stretch the points in the vector path to fit the parent box.
  <img src="https://i.stack.imgur.com/EotVm.png" alt="Here is what I want to scale to fill the parent box"></p>
  
  <p>Here is the undesirable result that I get.</p>
  
  <p><img src="https://i.stack.imgur.com/hvMgR.png" alt="enter image description here"></p>
  
  <p>Is there any good way to strech-to-fill the <em>geometry</em> while not scaling the line drawing thickness?</p>
  
  <p>I realize I could to this a few other ways with such simple geometry, but in my actual application the path is much more complicated.</p>
  
  <p>Here is my control code for those who are interested :</p>
  
  <pre><code>&lt;UserControl.Template&gt;
      &lt;ControlTemplate TargetType="{x:Type UserControl}"&gt;
          &lt;Grid&gt;
              &lt;Viewbox Stretch="Fill"&gt;
                  &lt;Canvas Name="svg2" Margin="0" Width="100" Height="63" &gt;
                      &lt;Path Fill="#FFFFFFFF" Stroke="#FF6800FF" StrokeThickness="4" StrokeStartLineCap="Flat" StrokeEndLineCap="Flat" StrokeLineJoin="Miter" StrokeMiterLimit="4" Name="rect2985" RenderTransformOrigin="0,0"&gt;
                          &lt;Path.Data&gt;
                              &lt;PathGeometry FillRule="Nonzero" Figures="M 0,250 L 0,50 L 150,50 L 200,-0.96 L 250,50 L 400,50 L 400,250 L 0,250z"&gt;
                                  &lt;PathGeometry.Transform&gt;
                                      &lt;TransformGroup&gt;
                                          &lt;ScaleTransform ScaleX=".24" ScaleY=".23" /&gt;
                                      &lt;/TransformGroup&gt;
                                  &lt;/PathGeometry.Transform&gt;
                              &lt;/PathGeometry&gt;
                          &lt;/Path.Data&gt;
  
                          &lt;Path.RenderTransform&gt;
                              &lt;TransformGroup&gt;
                                  &lt;TranslateTransform X="2.1" Y="3" /&gt;
                              &lt;/TransformGroup&gt;
                          &lt;/Path.RenderTransform&gt;
                      &lt;/Path&gt;
  
                      &lt;Grid Canvas.Top="17" Width="90" HorizontalAlignment="Center" Height="40" Canvas.Left="5"&gt;
                          &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"        
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/&gt;
                      &lt;/Grid&gt;
  
                  &lt;/Canvas&gt;
              &lt;/Viewbox&gt;
          &lt;/Grid&gt;
      &lt;/ControlTemplate&gt;
  &lt;/UserControl.Template&gt;
  </code></pre>