title: Efficient Scrolling command log view in XAML
body: <p>I have a large scale project with many large user controls written in XAML/VB.net.</p>
  
  <p>One main function of my software is to pass messages to remote device and display / use their response.</p>
  
  <p>I have made a scrolling text panel our out of a text box with some modifications. For the most part, this works decently. </p>
  
  <p>I'm looking for a way to improve the performance of this, I believe (but i'm not positive.) That a component like this should be using virtualization by default and should only be rendering what's on screen. I see memory increase as more and more messages are passed in and they seem to come slower and slower after a significant amount are present. </p>
  
  <p>Is there some correct way of implementing things such as in xaml? Are there any free resources that emulate something along the lines of command prompt as a WPF control? </p>
  
  <pre><code>&lt;Grid x:Name="grdRoot" &gt;
      &lt;ScrollViewer x:Name="Scroller"  Height="{Binding Path=ActualHeight, 
         RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}}" Width="{Binding Path=ActualWidth, 
         RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}}" HorizontalScrollBarVisibility="Auto"&gt;
          &lt;TextBox x:Name="txtLog" BorderThickness="0" IsReadOnly="True" Background="{Binding LogBackColor}" ContextMenu="{DynamicResource ctxMenu}" FontFamily="Consolas" AcceptsTab="True" AcceptsReturn="True" FontSize="13" TextOptions.TextFormattingMode="Display" MaxLines="20000000" TextWrapping="Wrap"/&gt;
  
  
      &lt;/ScrollViewer&gt;
  
   &lt;ItemsControl&gt;
          &lt;ItemsControl.ItemsPanel&gt;
              &lt;ItemsPanelTemplate&gt;
                  &lt;VirtualizingStackPanel IsItemsHost="true" &gt;
                  &lt;/VirtualizingStackPanel&gt;
              &lt;/ItemsPanelTemplate&gt;
          &lt;/ItemsControl.ItemsPanel&gt;
      &lt;/ItemsControl&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>Edit: I suppose I'm really using the wrong terminology. I'm trying to replicate a command line window, to show the passing back and forth of messages in an efficient way. </p>