RadRichTextBox Scrollbar Scroll Event Does Not Fire

6 posts, 0 answers
  1. Bob
    Bob avatar
    17 posts
    Member since:
    Jan 2011

    Posted 27 Jun 2011 Link to this post

    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?
  2. Bob
    Bob avatar
    17 posts
    Member since:
    Jan 2011

    Posted 27 Jun 2011 Link to this post

    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 :)
  3. DevCraft banner
  4. Vesko
    Admin
    Vesko avatar
    45 posts

    Posted 30 Jun 2011 Link to this post

    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
  5. Jerry T.
    Jerry T. avatar
    118 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2011 Link to this post

    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.
  6. Bob
    Bob avatar
    17 posts
    Member since:
    Jan 2011

    Posted 07 Sep 2011 Link to this post

    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.
  7. Jerry T.
    Jerry T. avatar
    118 posts
    Member since:
    Jul 2012

    Posted 07 Sep 2011 Link to this post

    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.
Back to Top
DevCraft banner