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
235
Disable horizontal scroll (only) in WinListView
posted

 Hi,

 I was wondering if there is a way to disable horizontal scrollbar in WinListView.

 Thanks,

Sameer

  • 69832
    Offline posted

    using nsScrollBar = Infragistics.Win.UltraWinScrollBar;

    this.ultraListView1.CreationFilter = new DisabledScrollbarCreationFilter( Orientation.Horizontal );

    #region DisabledScrollbarCreationFilter
    public class DisabledScrollbarCreationFilter : IUIElementCreationFilter
    {
        private Orientation orientation = Orientation.Horizontal;

        public DisabledScrollbarCreationFilter( Orientation orientation )
        {
            this.orientation = orientation;
        }

        #region IUIElementCreationFilter Members

        void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
        {
            if ( parent is UltraListViewUIElement )
            {
                foreach( UIElement element in parent.ChildElements )
                {
                    nsScrollBar.ScrollBarUIElement scrollBarElement = element as nsScrollBar.ScrollBarUIElement;
                    if ( scrollBarElement != null && scrollBarElement.Orientation == this.orientation )
                    {
                        scrollBarElement.Enabled = false;
                        break;
                    }
                }

            }
        }

        bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
        {
            return false;
        }

        #endregion
    }
    #endregion DisabledScrollbarCreationFilter