Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

wpf make both rich Text scroll

//You can use the ScrollViewer.ScrollChanged routed event to listen for
//scrolling changes. Example:
// in file.xaml
<UniformGrid Rows="1" Width="300" Height="150" >
    <RichTextBox x:Name="_rich1" 
                 VerticalScrollBarVisibility="Auto"
                 ScrollViewer.ScrollChanged="RichTextBox_ScrollChanged" />
    <RichTextBox x:Name="_rich2" 
                 VerticalScrollBarVisibility="Auto"
                 ScrollViewer.ScrollChanged="RichTextBox_ScrollChanged" />
</UniformGrid>

//Then, in the event handler you do the actual synchronizing
// in file.xaml.cs
private void RichTextBox_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
    var textToSync = (sender == _rich1) ? _rich2 : _rich1;

    textToSync.ScrollToVerticalOffset(e.VerticalOffset);
    textToSync.ScrollToHorizontalOffset(e.HorizontalOffset);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# unity destroy first child object 
Csharp :: unity temperature to colour 
Csharp :: InvalidOperationException: Calling Scene Raisefrom assembly reloading callbacks are not supported. 
Csharp :: snx disconnect linux 
Csharp :: turtle graphics face in direction 
Csharp :: how to turn off sprite renderer in unity 
Csharp :: enable canvas unity 
Csharp :: action being performed on this control is being called from the wrong thread c# 
Csharp :: c# get calling method name 
Csharp :: camera follow player 
Csharp :: Oculus Unity add haptics 
Csharp :: how to generate random letters in C# 
Csharp :: remove character from string c# 
Csharp :: uni valued tree 
Csharp :: unity animator current state name 
Csharp :: C# .net core convert int to enum 
Csharp :: how to configure session timeout in asp.net core 
Csharp :: C# Cast double to float 
Csharp :: ldap check user exists 
Csharp :: convert string to array c# 
Csharp :: how to add reference to rigidbody 2d 
Csharp :: stack to string c# 
Csharp :: c# swap variables 
Csharp :: unity 2d joystick controls 
Csharp :: unity destroy object invisible 
Csharp :: unity how to get the first word from string 
Csharp :: unity custom update 
Csharp :: c# loop through files in folder 
Csharp :: how to print c# 
Csharp :: csproj include folder and files 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =