title: How to enable auto-scroll for silverlight page
body: <p>There is a Silverlight page, it's width is 810 pixels, height is not specified:</p>
  
  <pre><code>&lt;NavigationControls:Page x:Class="VfmElitaSilverlightClientView.Pages.SquadView" 
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:NavigationControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
         xmlns:DataControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
         xmlns:InputControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
         xmlns:ToolkitControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" 
         xmlns:Pages="clr-namespace:VfmElitaSilverlightClientView.Pages" 
         xmlns:Controls="clr-namespace:VfmElitaSilverlightClientView.Controls"
         xmlns:Converter="clr-namespace:SilverlightCommonView.Converter;assembly=SilverlightCommonView" 
         mc:Ignorable="d" Width="810"
         Title="SquadView Page"&gt;
  &lt;NavigationControls:Page.Resources&gt;
      &lt;Converter:BooleanToVisibilityConverter x:Key="resourceBooleanToVisibilityConverter" /&gt;
      &lt;Converter:BooleanToVisibilityInvertedConverter x:Key="resourceBooleanToVisibilityInvertedConverter" /&gt;
  &lt;/NavigationControls:Page.Resources&gt;
  &lt;ToolkitControls:BusyIndicator IsBusy="{Binding IsBusy}" DisplayAfter="0" BusyContent="{Binding BusyContent}"&gt;
      &lt;StackPanel Background="Transparent" HorizontalAlignment="Stretch"&gt;
  
          &lt;StackPanel ... &gt;&lt;/StackPanel&gt;
          &lt;StackPanel ... &gt;&lt;/StackPanel&gt;
          &lt;StackPanel ... &gt;&lt;/StackPanel&gt;
  
          &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Center"&gt;
  
              &lt;Grid Margin="5" Width="500"&gt;...&lt;/Grid&gt;
  
              &lt;Canvas Height="180" Width="210"&gt;...&lt;/Canvas&gt;
  
          &lt;DataControls:DataGrid
                     IsReadOnly="True" HorizontalAlignment="Stretch" Margin="5" MinHeight="60" MaxHeight="460"
                     HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto"
                     RowHeight="18" VerticalAlignment="Top"
                     &gt;
          &lt;/DataControls:DataGrid&gt;
  
          &lt;Button Content="Save" HorizontalAlignment="Center"
                  Padding="10" Command="{Binding SaveButtonClickCommand,Mode=OneWay}"/&gt;
  
      &lt;/StackPanel&gt;
  &lt;/ToolkitControls:BusyIndicator&gt;
  </code></pre>
  
  <p></p>
  
  <p>Page is displayed with the following html-code:</p>
  
  <pre><code>&lt;div id="silverlightControlHost" style="height:&lt;%=Height%&gt;px;margin: auto;"&gt;
      &lt;object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%"&gt;
        &lt;param name="source" value="/ClientBin/app.xap"/&gt;
        &lt;param name="onError" value="onSilverlightError" /&gt;
        &lt;param name="background" value="transparent" /&gt;
            &lt;param name="windowless" value="true" /&gt;
        &lt;param name="initParams" value="&lt;%=InitParams %&gt;" /&gt; 
        &lt;param name="minRuntimeVersion" value="3.0.40624.0" /&gt;
        &lt;param name="autoUpgrade" value="true" /&gt;
        &lt;a href="http://go.microsoft.com/fwlink/?LinkID=149156&amp;v=3.0.40624.0" style="text-decoration:none"&gt;
            &lt;img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/&gt;
        &lt;/a&gt;
      &lt;/object&gt;
      &lt;iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"&gt;&lt;/iframe&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Among other controls there is a grid inside of page, number of grid rows is data dependent (from 17 up to 25-28), the grid row height is 22pixels. It is necessary to display all controls and all grid rows without scrolling.</p>
  
  <p>For my example, value of 'Height' property for page is set to '930'. For users that have a lot of data (25-28 rows in the data grid) most of the page is busy with data. But other users (18-20 rows) see big "empty" space, that is reserved for control.</p>
  
  <p>I tried to decrease height for the DIV that hosts Silverlight app - that cut off controls for 'big-data' case. Attempt to set style 'height' to 'auto' causes empty HTML-page (Silverlight control is not visible at all).</p>
  
  <p>Could you please advise, how to setup page height in order to be automatically stretched to fit whole controls?</p>
  
  <p>I not sure is this a Silverlight issue or HTML... </p>
  
  <p>Thanks!</p>