title: Scroll bar for user control in Silverlight
body: <p>I've got a user control defined as this:</p>
  
  <pre><code>&lt;UserControl
  x:Class="Client.UserControl1"
  d:DesignWidth="640" d:DesignHeight="480" MinWidth="400" MinHeight="400"                 
      ScrollViewer.HorizontalScrollBarVisibility="Auto"
      ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
  
  &lt;Grid x:Name="LayoutRoot" Background="White"&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="*"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="24"/&gt;
          &lt;RowDefinition Height="*"/&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;RichTextBox Margin="10" Grid.Row="1" HorizontalScrollBarVisibility="Auto"&gt;
          &lt;Paragraph&gt;&lt;Run Text="RichTextBox"/&gt;&lt;/Paragraph&gt;
      &lt;/RichTextBox&gt;
      &lt;sdk:Label Margin="0" Height="24" HorizontalAlignment="Center"    
        Content="Message"/&gt;
   &lt;/Grid&gt;
   &lt;/UserControl&gt;
  </code></pre>
  
  <p>I then use this control in a page as follows:</p>
  
  <pre><code>&lt;navigation:Page 
  Style="{StaticResource PageStyle}" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
  ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
  
  &lt;Grid x:Name="LayoutRoot" Background="Blue" 
   ScrollViewer.HorizontalScrollBarVisibility="Auto" 
   ScrollViewer.VerticalScrollBarVisibility="Auto"&gt;
      &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition Width="*" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
      &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="*" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Client:UserControl1 Margin="10"/&gt;
  &lt;/Grid&gt;
  &lt;/navigation:Page&gt;
  </code></pre>
  
  <p>I want the user control to fill the page. As the page expands, so does the user control. This works fine. However, I specify a minimum height and width for the user control. If the page is smaller than this, I want scroll bars to be shown. However, when I make the page smaller than the minimum size, no scrollbars appear.</p>
  
  <p>I've tried wrapping the user control in a scrollviewer, but this does not give me the behaviour I want. It this case, the rich text box contains is now drawn in its entirety, i.e. it no longer has any scroll bars of its own. I still want the rich text box to be bound by the size of the page, i.e. if the browser is maximized and the rich text box contains 100s of lines of text, I can still see the border of the rich text box, and the rich text box will have scroll bars to allow viewing of its contenxt. When the browser window is smaller than the min size of the control, then I want scrollbars for the user control.</p>
  
  <p>Is this possible?</p>
  
  <p>Cheers</p>