How to make TextBox Scrollable and Navigate to end of TextBox scrolling in Windows Phone

output_DNvWnz

In this example, I am going to show you, how easy we can build the such kind of functionality in windows phone application, here I have considered an example called “diagnostic tool functionality” in your Windows Phone application using two main controls like Textbox and ScrollViewer.

Here is the basic steps to achieve diagnostic tool functionality in your application.

Step:1 Add ScrollViewer to Windows Phone Page, here I have added it, inside the Grid layout content panel.

Step:2 Add Textbox inside the ScrollViewer see the below code snippet for the same.

image

Step:3 Now we are going to move into .CS file; and declare the DispatcherTimer object to run the diagnostic concept eventually. Now initialize the DispatcherTimer’s object (i.e oTimer) and add a Tick event and set the time interval. you can refer the below code snippet for the same.

image

Step:4 In the Tick Event of DispatcherTimer, we are writing core logic of it, how to make text box scrollable.

image

Step:5 Finally we are going to run the timer, using the timer’s API called  Start() method like oTimer.Start(); in this application I have use application bar button to run the timer on application bar button click.

image

Download: here is the example source code

Happy Coding – Smile

Advertisements

About Pavan Pareta

My name is Pavan Pareta, I enjoy computers and general technology. I am more interested in the areas of Computer Security, Programming and developing innovative s/w for Windows Mobile and Windows Phone 7. I like MS Technology and support open-source software, because I believe it plays a major role in knowledge sharing and exchange of ideas, which effectively leads to better software. Additionally, I am a follower of the KISS (Keep It Simple Stupid) philosophy. I Love C#.NET and recently I am fall in love with Silverlight :) Introduce to my machine My main workstation is a Intel Pentium Core Duo and my primary operating system is Windows 7.
This entry was posted in Windows Phone, Windows Phone 7, Windows Phone 8, Windows Phone APIs. Bookmark the permalink.

3 Responses to How to make TextBox Scrollable and Navigate to end of TextBox scrolling in Windows Phone

  1. Akhmed says:

    Very good post. In additional, you can use Dispatcher.BeginInvoke(() => { /* you code */ }); for single operation (such as adding text by pressing the button) instead DispatcherTimer. Thanks!

  2. Pavan Pareta says:

    Hello Akhmed,

    There is NO cross thread communication, so it is not required to use BeginInvoke method.
    DispatcherTimer runs on the same thread (UI Thread) opposed to System.Timers.Timer

    BeginInvoke basically called to when you have cross thread communication.

    Thanks

    • Akhmed says:

      Dispatcher.BeginInvoke can be used not only for cross-platform communication. Unfortunately, it has to be used for fixing a lot of bugs on the platform level for controls such as Panorama, Pivot, Applitsationbar etc. (if you use these controls a little more than just a display some controls in xaml)
      But you right. In this case, it is not necessary to use

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s