This is a migrated thread and some comments may be shown as answers.

RadRichTextBox Scrollbar Scroll Event Does Not Fire

5 Answers 200 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 27 Jun 2011, 07:17 PM
1)   Find the scrollbar in the Editor (Editor is my RadRichTextBox):
var
 vertScrollBar = Editor.ChildrenOfType<ScrollBar>().Where(s => s.Orientation == Orientation.Vertical).First();

2) This finds the scrollbar, so now we add an event:
   vertScrollBar.Scroll += new ScrollEventHandler(vertScrollBar_Scroll); 

Here is where I find out the event never fires. Am I missing something?

5 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 27 Jun 2011, 07:26 PM
I found the issue. For some reason the RadRichTextBox has two scroll areas in it. So instead of .First() in the Linq to find the scrollbar I used .Last() to get the 2nd one.

Now I wonder why there's two scrollviewers in there :)
0
Vesko
Telerik team
answered on 30 Jun 2011, 09:18 AM
Hello Bob,

Thanks for your question!
As I saw you have solved your problem. I just wanted to add that you could also use HorizontalScrollBar/VerticalScrollBar properties of RadRichTextBox.

Greetings,
Vesko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jerry T.
Top achievements
Rank 1
answered on 07 Sep 2011, 03:53 PM
What is the namespace for ScrollBar?

I've come across a few threads where I've found that I need to do a ChildrenOfType<ScrollBar> but I'm apparently missing a namespace and I've been searching and cannot find it.

I'm actually needing it for a RadGrid, though.
0
Bob
Top achievements
Rank 1
answered on 07 Sep 2011, 06:29 PM
The Silverlight ScrollBar is in System.Windows.Controls.Primitives

Here's the MSDN page for it:
http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.scrollbar.aspx

If Telerik has it's own ScrollBar control you might need to just do something like:
ChildrenOfType<System.Windows.Controls.Primitives.ScrollBar>
...to find any actual Silverlight ScrollBars. I know I had to do something similar with RichTextBox, I had to force my code to use the Telerik one, not the Silvelright one.
0
Jerry T.
Top achievements
Rank 1
answered on 07 Sep 2011, 06:31 PM
Much obliged!

The code builds now but still doesn't work...trying to keep a RadGridView's scrollbar enabled when the entire grid is disabled. Going to have to rethink apparently.
Tags
RichTextBox
Asked by
Bob
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Vesko
Telerik team
Jerry T.
Top achievements
Rank 1
Share this question
or