title: Synchronising Offsets between two ScrollViewers without code-behind
body: <p>Right now I have two scrollviewers who both need to have the same offset at all time.</p>
  
  <p>The (working) solution I have right now is with the ScrollChanged event.
  If the ScrollChanged event is triggered this code is executed:</p>
  
  <pre><code>scrollViewer.ScrollToHorizontalOffset(offset.X);
  scrollViewer.ScrollToVerticalOffset(offset.Y);
  </code></pre>
  
  <p>The fact is, I want to try to avoid this code-behind solution. </p>
  
  <p>I think the best solution for this problem is something like this (binding):</p>
  
  <pre><code> &lt;ScrollViewer x:Name="scrollviewer_Top" HorizontalOffset="{Binding ElementName=scrollViewer_Center, Path=HorizontalOffset}"&gt;...&lt;/ScrollViewer&gt;
  
   &lt;ScrollViewer x:Name="scrollViewer_Left" VerticalOffset="{Binding ElementName=scrollViewer_Center, Path=VerticalOffset}" &gt;...&lt;/ScrollViewer&gt;
  
   &lt;ScrollViewer x:Name="scrollViewer_Center" HorizontalOffset="{Binding ElementName=scrollviewer_Top, Path=HorizontalOffset}"
                                    VerticalOffset="{Binding ElementName=scrollViewer_Left, Path=VerticalOffset}"&gt;...&lt;/ScrollViewer&gt;
  </code></pre>
  
  <p>Now, when I try to build I got a few errors (HorizontalOffset/VerticalOffset cannot be set because it does not have an accesible set accessor).</p>
  
  <p>Anyone knows if this is the best solution and how to handle the error? Or should I stay with the code-behind event? </p>
  
  <p>Thanks</p>