Listview inside of scrollviewer prevents scrollviewer scroll

That happens because the ListView‘s (ListBox‘s, actually) content template wraps its items with a ScrollViewer by itself. The simplest way is to disable it by dropping your own Template for the inside ListView, one that doesn’t create a ScrollViewer: <ListView> <ListView.Template> <ControlTemplate> <ItemsPresenter></ItemsPresenter> </ControlTemplate> </ListView.Template> … </ListView> BTW the same happens if you have a … Read more

why setting ScrollViewer.CanContentScroll to false disable virtualization

“ScrollViewer currently allows two scrolling modes: smooth pixel-by-pixel scrolling (CanContentScroll = false) or discrete item-by-item scrolling (CanContentScroll = true). Currently WPF supports UI virtualization only when scrolling by item. Pixel-based scrolling is also called “physical scrolling” and item-based scrolling is also called “logical scrolling”.” Virtualization requires an item-based scrolling so it can keep track of … Read more

Stop WPF ScrollViewer automatically scrolling to perceived content

By default when a control receives the logical focus, FrameworkElement calls its own BringIntoView method (from within its OnGotFocus method if it has keyboard focus). That results in a RequestBringIntoView event being generated that bubbles up the element tree to allow ancestor elements to bring that portion of the element into view. The ScrollViewer listens … Read more

Animated (Smooth) scrolling on ScrollViewer

In your example there are two controls inherited from ScrollViewer and ListBox, the animation is implemented by SplineDoubleKeyFrame [MSDN]. In my time, I realized animation scrolling via the attached dependency property VerticalOffsetProperty, which allows you to directly transfer offset scrollbar into a double animation, like this: DoubleAnimation verticalAnimation = new DoubleAnimation(); verticalAnimation.From = scrollViewer.VerticalOffset; verticalAnimation.To … Read more

ScrollViewer not scrolling in WPF

Try a grid around your ScrollViwer instead of the StackPanel. I think StackPanel will provide as much height as the internal content wants, so here the Scrollviwer doesn’t work properly since its height is not get restricted by its parent control. You can understand the issue from the example below. <StackPanel> <ScrollViewer> <ItemsControl > <Rectangle … Read more

Child elements of scrollviewer preventing scrolling with mouse wheel?

You can also create a behavior and attach it to the parent control (in which the scroll events should bubble through). // Used on sub-controls of an expander to bubble the mouse wheel scroll event up public sealed class BubbleScrollEvent : Behavior<UIElement> { protected override void OnAttached() { base.OnAttached(); AssociatedObject.PreviewMouseWheel += AssociatedObject_PreviewMouseWheel; } protected override … Read more