Skip to main content

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets a value that indicates whether elements that support the IScrollInfo interface are allowed to scroll.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public bool CanContentScroll { get; set; }
property bool CanContentScroll {
	bool get();
	void set(bool value);
member CanContentScroll : bool with get, set
Public Property CanContentScroll As Boolean

Property Value


true if the ScrollViewer scrolls in terms of logical units; false if the ScrollViewer scrolls in terms of physical units. The default is false.

Content in a ScrollViewer can be scrolled in terms of physical units or logical units. Physical units are device independent pixels. Logical units are used for scrolling items within an ItemsControl. The default behavior of the ScrollViewer is to use physical units to scroll its content. However, in cases where the is set to true, the content could use logical units to scroll. For example, ListBox, ListView, and other controls that inherit from ItemsControl use logical units to scroll. If is true, the values of the , , , and properties are number of items, instead of physical units.

If you require physical scrolling instead of logical scrolling, wrap the host Panel element in a ScrollViewer and set its property to false. Physical scrolling is the default scroll behavior for most Panel elements.

Identifier field


Metadata properties set to true


The following example demonstrates how to set the property by using code.

private void scrollTrue(object sender, RoutedEventArgs e)
    sv1.CanContentScroll = true;
    sv1.Height = 600;
    myStackPanel.Visibility = Visibility.Visible;
    btn1.Visibility = Visibility.Collapsed;
Private Sub scrollTrue(ByVal sender As Object, ByVal args As RoutedEventArgs)
    sv1.CanContentScroll = True
    sv1.Height = 600
    myStackPanel.Visibility = Visibility.Visible
    btn1.Visibility = Visibility.Collapsed
End Sub
.NET Framework
Available since 3.0
Return to top