title: Override ScrollViewer ContentTemplate WPF
body: <p>I have a custom ScrollViewer template that I use to customize DocumentViewer control.</p>
  
  <pre><code>&lt;Style TargetType="{x:Type ScrollViewer}"  x:Key="CustomScrollPresenter"&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type ScrollViewer}"&gt;
                      &lt;Grid Background="{TemplateBinding Panel.Background}"&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="*" /&gt;
                              &lt;ColumnDefinition Width="Auto" /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition Height="*" /&gt;
                              &lt;RowDefinition Height="Auto" /&gt;
                          &lt;/Grid.RowDefinitions&gt;
                          &lt;Rectangle Grid.Column="1" Grid.Row="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" /&gt;
                          &lt;ScrollContentPresenter
  
                      Grid.Column="0" 
                      Grid.Row="0" 
                      Margin="{TemplateBinding Control.Padding}" 
                      Content="{TemplateBinding ContentControl.Content}" 
                      ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
                      CanContentScroll="{TemplateBinding ScrollViewer.CanContentScroll}" /&gt;
                          &lt;ScrollBar 
                      x:Name="PART_VerticalScrollBar"
                      Grid.Column="1" 
                             Grid.Row="0" 
                             Minimum="0" 
                             Maximum="{TemplateBinding ScrollViewer.ScrollableHeight}" 
                             ViewportSize="{TemplateBinding ScrollViewer.ViewportHeight}" 
                             Value="{Binding Path=VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
                             Visibility="{TemplateBinding ScrollViewer.ComputedVerticalScrollBarVisibility}" 
                             Cursor="Arrow" AutomationProperties.AutomationId="VerticalScrollBar" /&gt;
                          &lt;ScrollBar 
                      x:Name="PART_HorizontalScrollBar"
                      Orientation="Horizontal" Grid.Column="0" Grid.Row="1" Minimum="0" 
                             Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}" ViewportSize="{TemplateBinding ScrollViewer.ViewportWidth}" Value="{Binding Path=HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}" Cursor="Arrow" AutomationProperties.AutomationId="HorizontalScrollBar" /&gt;
  
                      &lt;/Grid&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>But how do I override ContentTemplate of ScrollViewer? I mean, what can I use to replace this:</p>
  
  <pre><code>ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
  </code></pre>
  
  <p>with something that I can use to style every item in ScrollViewer? For example under every item of ScrollViewer add a TextBlock with some page description?</p>
  
  <p>Thank you!</p>