Scrollbar customization in Windows Forms ListView Control

27 Sep 20243 minutes to read

This section explains how to customize the scrollbar visibility and behavior in the SfListView control.

AutoHideScrollBars

The SfListView allows you to automatically show or hide horizontal and vertical scrollbars using the AutoHideScrollBars property. By default, AutoHideScrollBars is set to true. This property manages scrollbar visibility based on content overflow.

using Syncfusion.WinForms.ListView;
   
   namespace WindowsFormsApplication1
   {
       public partial class Form1 : Form
       {
           public Form1()
           {
               InitializeComponent();
               SfListView sfListView1 = new SfListView ();
               sfListView1.AutoHideScrollBars = true;
           }
       }
   }
Imports Syncfusion.WinForms.ListView
   
   Namespace WindowsFormsApplication1
   	Partial Public Class Form1
   		Inherits Form
   		Public Sub New()
   			InitializeComponent()
   			Dim sfListView1 As New SfListView()
                        sfListView1.AutoHideScrollBars = True  
   		End Sub
   	End Class
   End Namespace

ScrollbarCustomization

Customizing Scrollbar Visibility

HorizontalScrollBarVisible

The HorizontalScrollBarVisible property is used to show or hide the horizontal scrollbar. When AutoHideScrollBars is set to false, the visibility of the horizontal scrollbar will depend on the value of HorizontalScrollBarVisible.

VerticalScrollBarVisible

The VerticalScrollBarVisible property is used to show or hide the horizontal scrollbar. When AutoHideScrollBars is set to false, the visibility of the vertical scrollbar will depend on the value of VerticalScrollBarVisible.

sfListView1.AutoHideScrollBars = false;
sfListView1.HorizontalScrollBarVisible = true;
sfListview1.VerticalScrollBarVisible = true;
sfListView1.AutoHideScrollBars = False
sfListView1.HorizontalScrollBarVisible = True
sfListview1.VerticalScrollBarVisible = True

ScrollbarCustomization

Scroll Increments

HorizontalScrollIncrement

The HorizontalScrollIncrement property allows you to set the multiplier for mouse wheel scrolling during horizontal scrolling. This property lets users customize the increment value for each scroll step of the mouse wheel.

VerticalScrollIncrement

The VerticalScrollIncrement property allows you to set the multiplier for mouse wheel scrolling during vertical scrolling. Users can customize the increment value for each scroll step of the mouse wheel.

sfListView1.HorizontalScrollIncrement = 5;
sfListView1.VerticalScrollIncrement = 5;
sfListView1.HorizontalScrollIncrement = 5
sfListView1.VerticalScrollIncrement = 5