Advertise with us

How can I disable horizontal scrolling in a WPF listbox?

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

Last updated:7/18/2013 2:36:23 AM

1 Answers

shreesh chandra shukla
shreesh chandra shukla

Solution!

In XAML:

<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" />

In C#:

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


Answer