Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7746323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:15:00+00:00 2026-06-01T10:15:00+00:00

I want to have a fixed-width TextBlock that has long, unbroken, horizontal text, and

  • 0

I want to have a fixed-width TextBlock that has long, unbroken, horizontal text, and am looking for a good approach to allow all the text to be read by the user. I want something more sophisticated than just putting the control inside a ScrollViewer.

First (ideal) option is to be able to hover the mouse over the TextBlock and if the mouse is right of center for example, it would scroll to the right (with increasing speed the further you move from the center). I guess this is do-able, by handling MouseEnter / MouseOver events on the TextBlock, figuring out where the cursor is within the TextBlock, and enabling some marquee/animation as appropriate. I’m looking for approaches on how to do this, particularly as I have little experience with animation in WPF. Would like to figure out the detail myself but struggling to get started.

Second option would be to have a RepeatButton on either side of the text, and when you hover over that, it scrolls the text.

An initial attempt:

<RepeatButton ClickMode="Hover"
              Command="{x:Static ComponentCommands.MoveLeft}"
              CommandTarget="{Binding ElementName=TextAutoScroller}"
              Content="Go left" />

<ScrollViewer x:Name="TextAutoScroller" Grid.Column="1"
              VerticalScrollBarVisibility="Disabled"
              HorizontalScrollBarVisibility="Hidden">
    <TextBlock VerticalAlignment="Center"
               Text="The quick brown fox jumps over the lazy dog.&#x0d;&#x0a;The quick brown fox jumps over the lazy dog.&#x0d;&#x0a;The quick brown fox jumps over the lazy dog." />
</ScrollViewer>

<RepeatButton Grid.Column="2"
              ClickMode="Hover"
              Command="{x:Static ComponentCommands.ScrollPageRight}"
              CommandTarget="{Binding ElementName=TextAutoScroller}"
              Content="Go right" />

The problem with this is that both RepeatButton controls are disabled – seems that neither MoveLeft or ScrollPageRight are supported, but ScollPageDown (no good for my horizontal scenario) works ok?

Any tips or suggestions on either option would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:15:02+00:00Added an answer on June 1, 2026 at 10:15 am

    A good solution for the repeatable button version would be to just scroll the scrollviewer incrementally.

    private void scrollLeft_Click(object sender, RoutedEventArgs e)
    {
        sv.ScrollToHorizontalOffset(sv.HorizontalOffset - 10);
    }
    
    private void scrollRight_Click(object sender, RoutedEventArgs e)
    {
        sv.ScrollToHorizontalOffset(sv.HorizontalOffset + 10);
    }
    

    The above assumes your text is wrapped in a scrollviewer named sv, with two repeatbuttons.

    If you want to speed up the longer you’ve held it in:

        private int offset = 1;
        private int maxOffset = 50;
    
        private void scrollLeft_Click(object sender, RoutedEventArgs e)
        {
            sv.ScrollToHorizontalOffset(sv.HorizontalOffset - offset);
            offset += offset < maxOffset ? 1 : 0;
        }
    
        private void scrollRight_Click(object sender, RoutedEventArgs e)
        {
            sv.ScrollToHorizontalOffset(sv.HorizontalOffset + offset);
            offset += offset < maxOffset ? 1 : 0;
        }
    
        private void scrollRight_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            offset = 1;
        }
    

    I would also weigh in and suggest not using the ClickMode=”Hover”… Users are more accustomed to clicking buttons. Just my two cents.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JScrollPane with FlowLayout that I want to have a fixed width.
I have a fixed-width page that I want to add a simple border to
I have a fixed width element that I want to essentially shoot off the
I have a fixed width div on my page that contains text. When I
I have a splitcontainer with horizontal orientation. I want a fixed height for panel2
I want the right div to have a fixed width and the left div
I have a fixed width input of type text. If the user was to
I have a UserControl (XAML below) that has a ListBox that I want to
I want to have a fixed width <div> on the left, and a flexible
On my site, I have a fixed-width central wrapper, which I don't want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.