Clyde Eisenbeis

Clyde Eisenbeis

  • 1.7k
  • 89
  • 15.7k

What is a simple way to add Scrollbars to a ListBox? - Continued #2

Jan 15 2025 12:14 PM

C# WPF --- This is a "continuation" of c-sharpcorner.com/forums/what-is-a-simple-way-to-add-scrollbars-to-a-listbox.

XAML

<StackPanel Orientation="Vertical">
  <ListBox x:Name="gLBxCharacters" 
    Margin="5,0,5,0" 
    ScrollViewer.HorizontalScrollBarVisibility="Visible"
    ScrollViewer.VerticalScrollBarVisibility="Visible"
    />
</StackPanel>

This does not work.

XAML

  <ListBox x:Name="gLBxCharacters" 
    Margin="5,0,5,0" 
    ScrollViewer.HorizontalScrollBarVisibility="Visible"
    ScrollViewer.VerticalScrollBarVisibility="Visible"
    />

This does work after <StackPanel ...> is removed.