Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
Show scroll bar only on hover
posted

I would like to only show the scroll bars on hover of a grid, a tree and so on. Is this possible?

  • 1560
    Offline posted
    Hello Stephan,
    I have been looking into your question and I determined that the behavior you are looking for can be achieved. Since there are differences in the controls implementation and properties, this will require a separate approach for each control. However, the logic will be similar. 
    By design when the data is too big to fit in the visible space the scrollbars will appear, so first, when the data is bound to the control they have to be set to not showing manually.
    The events that will show and hide the scrollbars on hover are MouseHover and MouseLeave. For example, if the control is UltraGrid :
    public Form1()
            {
                InitializeComponent();
                ultraGrid1.DisplayLayout.Scrollbars = Infragistics.Win.UltraWinGrid.Scrollbars.None;
            }
     private void ultraGrid1_MouseHover(object sender, EventArgs e)
            {
                ultraGrid1.DisplayLayout.Scrollbars = Infragistics.Win.UltraWinGrid.Scrollbars.Both;
            }
     
            private void ultraGrid1_MouseLeave(object sender, EventArgs e)
            {
                ultraGrid1.DisplayLayout.Scrollbars = Infragistics.Win.UltraWinGrid.Scrollbars.None;
            }

    If the control is UltraTree the property that has to be set is called Scrollable and about the possible values could be found here.
    A sample application that demonstrates how such a behavior could be achieved for UltraTree and UltraGrid could be found in this link. The logic for other controls has to be similar. 
    If you require any further assistance or questions on the matter, please let me know.
    Sincerely,
    Teodosia Hristodorova
    Associate Software Developer