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

radTreeView disable scrollbar

4 Answers 422 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 07 Aug 2008, 01:35 PM
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



4 Answers, 1 is accepted

Sort by
0
Accepted
Jordan
Telerik team
answered on 08 Aug 2008, 10:36 AM
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.
0
Michael
Top achievements
Rank 1
answered on 08 Aug 2008, 03:08 PM
This is working fine,
thanks a lot !

Michael
0
Berkant Oral
Top achievements
Rank 1
answered on 15 Aug 2012, 08:16 AM
I am using version 2012.2.726.40 and    this.radTreeView1.HScrollBar doesn't have an event called VisibleChanged  . How can i  do this?
0
Boryana
Telerik team
answered on 16 Aug 2012, 04:17 PM
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
Tags
Treeview
Asked by
Michael
Top achievements
Rank 1
Answers by
Jordan
Telerik team
Michael
Top achievements
Rank 1
Berkant Oral
Top achievements
Rank 1
Boryana
Telerik team
Share this question
or