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 7614149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:19:46+00:00 2026-05-31T02:19:46+00:00

As I need to display long text strings in one of my WP7 project,

  • 0

As I need to display long text strings in one of my WP7 project, I added Alex Yakhnin’s ScrollableTextBlock control to it.

It’s working as expected, but I need to scroll the textblock automatically on certain user interaction, but the control doesn’t support ScrollToVerticalOffset out of the box and I have no idea how to go about it.

I guess removing the element and adding new one would do it, but I think that’s doing bit too much for such a simple task.

  • 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-05-31T02:19:47+00:00Added an answer on May 31, 2026 at 2:19 am

    One kind of ugly workaround is to add a Load-event to the ScrollViewer. When the event fires, fetch the sender (which is the ScrollViewer, duh!) and store it in a class-level variable. This way you have access to it in other methods and you can use the ScrollToVerticalOffset-method.

    XAML

    <PhoneApp1:ScrollableTextBlock x:Name="TextBlockOne" Margin="0,0,-12,0">
        <PhoneApp1:ScrollableTextBlock.Style>
            <Style TargetType="PhoneApp1:ScrollableTextBlock" >
                <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="PhoneApp1:ScrollableTextBlock">
                            <ScrollViewer Foreground="{TemplateBinding Foreground}"
                                          Background="{TemplateBinding Background}" 
                                          BorderBrush="{TemplateBinding BorderBrush}"
                                          BorderThickness="{TemplateBinding BorderThickness}" 
                                          Padding="{TemplateBinding Padding}"
                                          Loaded="ScrollViewer_Loaded">
                                <StackPanel Orientation="Vertical" x:Name="StackPanel" />
                            </ScrollViewer>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </PhoneApp1:ScrollableTextBlock.Style>
    </PhoneApp1:ScrollableTextBlock>
    

    C#

    private ScrollViewer _scroller;
    
    private void ScrollViewer_Loaded(object sender, System.Windows.RoutedEventArgs e)
    {
        _scroller = sender as ScrollViewer;
    }
    
    private void SomeMethod()
    {
        _scroller.ScrollToVerticalOffset(200d);
    }
    

    I know it’s probably not the nicest solution but it works. Hope this helps!

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

Sidebar

Related Questions

I need to simply wrap long text to display it in a few lines.
I have a widget where I need to display some text on one row.
I need to display very long text (~10 pages) on my web site. These
Long story short, I need to display some coloured text with a coloured background
I need to create a panel to display a long radiobutton form with a
i am developing one application with map view i need display the weather depends
I need to display image and one button on fancybox popup but I can't
I need to display all the employees in one webpart. I created the gridview
I am working on a contact list project and the last thing i need
I need to display some text on two lines, and add some ... if

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.