radTreeView disable scrollbar

5 posts, 1 answers
  1. Michael
    Michael avatar
    6 posts
    Member since:
    Aug 2008

    Posted 07 Aug 2008 Link to this post

    Hello,

    I want to disable the scrollbars of a radTreeView. Could you please help me to do this. I have already tried to set to false the Visible and/or the Enable properties of VerticalScroll and/or HScrollBar, but the scrollbars are still visible.
    Thanks.

    Best regards,
    Michael



  2. Answer
    Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 08 Aug 2008 Link to this post

    Hello Michael,

    That is because the visibility of the scrollbars in RadTreeView is updated on layout.
    You could handle the VisibleChanged event of the scrollbars and in the handler set the visibility to false like:
    public Form1() 
            { 
                InitializeComponent(); 
     
                this.radTreeView1.HScrollBar.VisibleChanged += new EventHandler(HScrollBar_VisibleChanged); 
            } 
     
            void HScrollBar_VisibleChanged(object sender, EventArgs e) 
            { 
                this.radTreeView1.HScrollBar.Visible = false
            } 

    Hope this helps.

    Best wishes,
    Jordan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    6 posts
    Member since:
    Aug 2008

    Posted 08 Aug 2008 Link to this post

    This is working fine,
    thanks a lot !

    Michael
  5. Berkant Oral
    Berkant Oral avatar
    7 posts
    Member since:
    Aug 2009

    Posted 15 Aug 2012 Link to this post

    I am using version 2012.2.726.40 and    this.radTreeView1.HScrollBar doesn't have an event called VisibleChanged  . How can i  do this?
  6. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 16 Aug 2012 Link to this post

    Hello Berkant Oral,

    Thank you for writing.

    To hide the horizontal scrollbar, you need to subscribe to the RadPropertyChanged event of the HScrollBar and set the Visibility property to collapsed. Here is a sample snippet:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.radTreeView1.HScrollBar.Visibility = ElementVisibility.Collapsed;
            this.radTreeView1.HScrollBar.RadPropertyChanged += new RadPropertyChangedEventHandler(HScrollBar_RadPropertyChanged);
        }
     
     
        void HScrollBar_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
        {
            if (e.Property == RadItem.VisibilityProperty)
            {
                this.radTreeView1.HScrollBar.Visibility = ElementVisibility.Collapsed;
            }
        }
    }

    Attached is a sample project that demonstrates the above snippet.

    I hope you find my answer useful. Let me know if you have further queries.

    Kind regards,
    Boryana
    the Telerik team
Back to Top
UI for WinForms is Visual Studio 2017 Ready