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
30
How to hide horizontal scrollbar in CardView?
posted

I have an UltraGrid in CardView that is showing horizontal scrollbar even though all records are in view will some space left on the right. There will always a fixed number of records and the grid has enough space to display all of them so there is no need for the horizontal scrollbar. I've tried DisplayLayout.ScrollBars to None but this isn't working.

Is there a way to hide the horizontal scrollbar when in CardView?

  • 1560
    Offline posted

    Hello,

    I have created a small sample trying to reproduce the described behavior and I determined that when all records are in view the horizontal scrollbar is disabled however it is still visible as you said. In order to hide it, I set its BackColor to transparent and the ScrollBarArrowStyle to None. However, in order to be able to change the BackColor property, you will need to set the ThemedElementAlpha property of the horizontal scrollbar appearance to transparent as well. This way you disabled the OS Themes applied on it by default and you can change its appearance per your requirement.

     public Form1()
            {
                InitializeComponent();
                this.ultraGrid1.DataSource = GetTable();
                this.ultraGrid1.DisplayLayout.Bands[0].CardView = true;
     
                this.ultraGrid1.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;
     
                this.ultraGrid1.DisplayLayout.ScrollBarLook.AppearanceHorizontal.ThemedElementAlpha = Infragistics.Win.Alpha.Transparent;
                this.ultraGrid1.DisplayLayout.ScrollBarLook.AppearanceHorizontal.BackColor = Color.Transparent;
                this.ultraGrid1.DisplayLayout.ScrollBarLook.ScrollBarArrowStyle = ScrollBarArrowStyle.None;
            }

    Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this case.

    Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.

    Thank you for your cooperation.

    Looking forward to hearing from you.

    Sincerely,

    Teodosia Hristodorova

    Associate Software Developer

    2313.UltraGrid_CardView_HorizontalScrollbar.zip