HOW CAN I DISABLE HORIZONTAL SCROLLING IN A WPF LISTBOX?

E E Cummings

Total Post:26

Points:182
Posted by  E E Cummings
WPF 
WPF
 5557  View(s)
Ratings:
Rate this:
Hi Developers!

This seems to be an absurdly simple question but Google and SO searches yield nothing. How can I disable horizontal scrolling in a WPF listbox when items take up more horizontal space than is available in the box?

thanks in advance

  1. shreesh chandra shukla

    Post:105

    Points:735
    Re: How can I disable horizontal scrolling in a WPF listbox?

    Solution!

    In XAML:

    <ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" />

    In C#:

    myListBox.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!