Answer the question
In order to leave comments, you need to log in
How to make a list scroll with the mouse in WPF?
In general, the essence of the question is in the title, there is a list that is filled dynamically with something like this:
<ScrollViewer Height="256"> <ListBox x:Name="ResultList" ItemsSource="{Binding}" HorizontalAlignment="Stretch" > <ListBox.ItemTemplate> <DataTemplate DataType="local:Line"> <StackPanel VerticalAlignment="Center" Orientation="Horizontal"> <TextBlock x:Name="textBlock" TextWrapping="Wrap" Text="{Binding Title}" Width="80"/> <TextBlock x:Name="textBlock1" TextWrapping="Wrap" Text="{Binding Text}" Width="280"/> <TextBlock x:Name="textBlock2" TextWrapping="Wrap" Text="TextBlock"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </ScrollViewer>
Answer the question
In order to leave comments, you need to log in
Why ScrollViewer? ListBox itself supports scrolling. Both mouse and scrollbar.
Remove the ScrollViewer and the mouse wheel will scroll.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question