title: Control's scroll bar hidden by border element when adjusting window's size
body: <p>I have a WPF window which I have tried to add scrolls bar to, however the scroll bars get overlapped by the <code>Border</code> element unless I resize the window exactly.</p>
  <p>I have attached some pictures to show you what is happening. Can anyone help me solve this graphical error so that the scroll bars are never overlapped by whatever?</p>
  <p><a href="https://i.stack.imgur.com/xbclW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xbclW.png" alt="Picture of WPF Window border element overlapping scroll bars" /></a></p>
  <p>And here is the code for the WPF window:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Window x:Class=&quot;TrackerClient.BITDisplayWindow&quot;
          xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
          xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
          Title=&quot;System Status (Built-In Test)&quot; 
          MaxHeight=&quot;{x:Static SystemParameters.PrimaryScreenHeight}&quot; 
          MaxWidth=&quot;{x:Static SystemParameters.PrimaryScreenWidth}&quot; 
          Height=&quot;450&quot; Width=&quot;900&quot; 
          WindowStartupLocation=&quot;CenterOwner&quot;
          Loaded=&quot;Window_Loaded&quot; Closed=&quot;Window_Closed&quot;&gt;
  
      &lt;Grid&gt;
          &lt;ScrollViewer HorizontalScrollBarVisibility=&quot;Auto&quot; Style=&quot;{DynamicResource ResourceKey=styleScrollViewer}&quot; VerticalScrollBarVisibility=&quot;Auto&quot; Grid.Column=&quot;0&quot;&gt;
              &lt;Border Name=&quot;m_hostElement&quot; BorderBrush=&quot;Black&quot; BorderThickness=&quot;1&quot; HorizontalAlignment=&quot;Stretch&quot; Height=&quot;auto&quot; VerticalAlignment=&quot;Stretch&quot; Width=&quot;auto&quot; Margin=&quot;10&quot; Grid.Column=&quot;1&quot;/&gt;
          &lt;/ScrollViewer&gt;
      &lt;/Grid&gt;
  
  &lt;/Window&gt;
  </code></pre>