Skip to main content
.NET Framework Class Library
ScrollViewerCanContentScroll Property

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 Property CanContentScroll As [%$TOPIC/ms593867_en-us_VS_110_2_0_0_0_0%]
public [%$TOPIC/ms593867_en-us_VS_110_2_0_1_0_0%] CanContentScroll { get; set; }
property [%$TOPIC/ms593867_en-us_VS_110_2_0_2_0_0%] CanContentScroll {
	[%$TOPIC/ms593867_en-us_VS_110_2_0_2_0_1%] get ();
	void set ([%$TOPIC/ms593867_en-us_VS_110_2_0_2_0_2%] value);
member CanContentScroll : [%$TOPIC/ms593867_en-us_VS_110_2_0_3_0_0%] with get, set
function get CanContentScroll () : [%$TOPIC/ms593867_en-us_VS_110_2_0_4_0_0%] 
function set CanContentScroll (value : [%$TOPIC/ms593867_en-us_VS_110_2_0_4_0_1%])
<object CanContentScroll="[%$TOPIC/ms593867_en-us_VS_110_2_0_5_0_0%]" .../>

Property Value

Type: SystemBoolean
true if the ScrollViewer scrolls in terms of logical units; false if the ScrollViewer scrolls in terms of physical units. The default is false.
Dependency Property Information

Identifier field


Metadata properties set to true



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 CanContentScroll 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 CanContentScroll is true, the values of the ExtentHeight, ScrollableHeight, ViewportHeight, and VerticalOffset 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 CanContentScroll property to false. Physical scrolling is the default scroll behavior for most Panel elements.


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

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
private void scrollTrue(object sender, RoutedEventArgs e)
    sv1.CanContentScroll = true;
    sv1.Height = 600;
    myStackPanel.Visibility = Visibility.Visible;
    btn1.Visibility = Visibility.Collapsed;
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1