XAML popup overflow in WPF
<p>I have a Popup that looks like this:</p>

<p><code>&lt;local:toolbox_popup x:Name="PopupBaseMapLayers" Grid.Row="1" StaysOpen="False" 
    PopupAnimation="Fade"  VerticalAlignment="Stretch"  AllowsTransparency="True" 
    PlacementTarget="{Binding ElementName=tooldropdown}" PlacementRectangle="-280,0,0,0" &gt;
    &lt;StackPanel&gt; 
    &lt;ScrollViewer VerticalScrollBarVisibility="Auto"  VerticalAlignment="Stretch" &gt;
    &lt;/SrollViewer&gt;
    &lt;/StackPanel&gt;
    &lt;/local:toolbox_popup&gt;
</code></p>

<p>So the Popup appears when the user clicks a button, but the popup overflows outside the window because of how long it is. Is there a way to either have the overflow hidden within the window or set the height of the popup to be dynamic with whatever the size of the window is?</p>