Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 1.29 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how can I synchronize two scroll bars?
  2. <RichTextBox ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible" Name="TextInput" AcceptsReturn="True" TextChanged="TextChangedEventHandler" Margin="0,23,0,9" ScrollViewer.ScrollChanged="OnScrollChangedHandler" HorizontalScrollBarVisibility="Visible" Grid.RowSpan="2" Grid.ColumnSpan="9" HorizontalAlignment="Right" Width="432.493">
  3.             <RichTextBox.Resources>
  4.                 <Style TargetType="{x:Type Paragraph}">
  5.                     <Setter Property="Margin" Value="0"/>
  6.                 </Style>
  7.             </RichTextBox.Resources>
  8.         </RichTextBox>
  9.  
  10.     <ScrollViewer Name="ScrollRow" VerticalScrollBarVisibility="Visible" ScrollViewer.ScrollChanged="OnRowsScrollChangedHandler" ScrollViewer.HorizontalScrollBarVisibility="Visible" Grid.RowSpan="2" Margin="0,23,0,7.02" HorizontalAlignment="Left" Width="40">
  11.                     <StackPanel Name="pScrollRow">
  12.                       <ListView Margin="0,23,0,9" Name="Rows">
  13.                         1.
  14.                       </ListView>
  15.           </StackPanel>
  16.            </ScrollViewer>
  17.        
  18. // ...
  19.  
  20.  private void OnScrollChangedHandler(object sender, ScrollChangedEventArgs e)
  21.         {
  22.             ((IScrollInfo)pScrollRow).SetHorizontalOffset(e.HorizontalOffset);
  23.         }