C# WPF --- This is a "continuation" of c-sharpcorner.com/forums/what-is-a-simple-way-to-add-scrollbars-to-a-listbox.
XAML
C#
This does not work.
XAML
C#
This does work after <StackPanel ...> is removed.
C# WPF --- This is a "continuation" of c-sharpcorner.com/forums/what-is-a-simple-way-to-add-scrollbars-to-a-listbox.
XAML
This does not work.
XAML
This does work after <StackPanel ...> is removed.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Tuhin PaulRank #7 · 71.9K reputationPosted Jan 15, 2025, 1:26 PM EST
using System.Windows; namespace WpfApp1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); // Add items to the ListBox for (int i = 0; i < 100; i++) { gLBxCharacters.Items.Add("Item " + i); } } } }Here the ListBox is placed inside a Grid, which allows it to grow and shrink as the window is resized. The ScrollViewer properties are set to make the horizontal and vertical scrollbars visible.