Scroll wheel issue when RadRichTextBox is inside Radcarousel

3 posts, 0 answers
  1. Haifeng
    Haifeng avatar
    2 posts
    Member since:
    Sep 2011

    Posted 05 Oct 2011 Link to this post

    Hi there,

    When I place a readonly RadRichTextBoxes as template inside a RadCarousel and the focus is on the RadRichTextBox, the scroll wheel scrolls RadCarousel instead of the content inside the RadRichTextBox.  When I put a FlowDocumentViewer in place of the RadRichTextBox,  the scroll wheel scrolls correctly.  Is there a workaround for this?

    Thanks
    Haifeng 
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 10 Oct 2011 Link to this post

    Hello Haifeng,

    The problem occurs because RadRichTextBox does not handle the MouseWheel event when the value of the VerticalScrollBar changes. We will consider implementing this functionality in the future.

    You can workaround this issue by handling the mouse wheel event whenever needed. Provided that you have subscribed to the Loaded and Unloaded event of the RadRichTextBox in the DataTemplate of the RadCarousel, you can do that as follows:

    void radRichTextBox_Loaded(object sender, RoutedEventArgs e)
    {
        RadRichTextBox richTextBox = (RadRichTextBox)sender;
        if (richTextBox.VerticalScrollBar.Visibility == Visibility.Visible)
        {
            richTextBox.MouseWheel += richTextBox_MouseWheel;
        }
    }
     
    void richTextBox_MouseWheel(object sender, MouseWheelEventArgs e)
    {
        e.Handled = true;
    }
     
    private void radRichTextBox_Unloaded(object sender, RoutedEventArgs e)
    {
        RadRichTextBox richTextBox = (RadRichTextBox)sender;
        richTextBox.MouseWheel -= richTextBox_MouseWheel;
    }

    I hope this helps.  Best wishes,
    Iva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Haifeng
    Haifeng avatar
    2 posts
    Member since:
    Sep 2011

    Posted 18 Oct 2011 Link to this post

    You guys are awesome!
Back to Top