WPF ListBox scrollbar is not working
10,768
You need to put the ListBox in a Grid. The StackPanel has an
infinite height, so that the ScrollBar does not get enabled or visible.
<Grid>
<ListBox VerticalAlignment="Stretch" />
</Grid>
Author by
Stacked
A passionate software developer (.NET) MCSD: App Builder MCSA: Web Applications LinkedIn WordPress Blog
Updated on June 04, 2022Comments
-
Stacked almost 2 years
<ListBox Name="myListBx" ItemsSource="{Binding Collection}" Margin="5,5" SelectedValuePath="ColId" SelectedValue="{Binding Path=ColId}" SelectionMode="Multiple" BorderThickness="0" Background="{x:Null}" BorderBrush="{x:Null}" ScrollViewer.VerticalScrollBarVisibility ="Auto"> <ListBox.ItemTemplate> <DataTemplate> // blabla </DataTemplate> </ListBox.ItemTemplate> </ListBox>
My ListBox contains so many elements and actually the scrollbar should work but it's not even visible. Am I doing something wrong?
Thanks
-
Stacked about 11 yearsWorks fine! Thank you Jehof