1

Is it possible to configure ListView so that it scrolls line by line, instead of scrolling an item at once, which is the default behavior even if the item is multiline?

4
  • I am afraid there is no such option. When I am not satisfied with the Scrolling behaviour I simply set CanContentScroll to false. This changes the bahaviour. This tells the underlying stackpanel that it is not responsible for scrolling one item at a time.
    – Xeun
    Commented Jan 12, 2015 at 11:46
  • @Xeun: thanks. Quick question then: where in the XAML do I specify this attribute? Can't find it with Google... Commented Jan 12, 2015 at 11:50
  • 1
    you can maybe play around with the example code from here. Might mean that you need to change ListView to StackPanel. CanContentScroll is from here (it might be an attached property on the ListView)
    – default
    Commented Jan 12, 2015 at 11:52
  • 1
    Yes, Default is right. CanContentScroll is an attached property of the ScrollViewer. Therefore you can use something like. <ListView ScrollViewer.CanContentScroll="False" ... />
    – Xeun
    Commented Jan 12, 2015 at 11:54

1 Answer 1

3

There is no easy way, to scroll line by line. However you can try this:

By default a ListBox/ListView scrolls "intelligently" one item at a time. This behaviour is provided by a Scrollviewer, by default the Property CanContentScroll is set to true which indicates that the items panel, f.e. a StackPanel is responsible for the scrolling and tries to scroll one item at a time.

To get close to your behaviour you simply set the Attached Property CanContentScroll to false, which enables to scroll pixel per pixel.

<ListView ScrollViewer.CanContentScroll="False" ... />

Also have a look at the link mentioned by Default which explains the interface IScrollInfo. As he mentioned you can find tutorials here. However in my opinion this is way too much effort, for some simple scrolling. I normally use the easy workaround.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.