Export (0) Print
Expand All

ScrollViewer.CanContentScroll 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)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public bool CanContentScroll { get; set; }
/** @property */
public boolean get_CanContentScroll ()

/** @property */
public void set_CanContentScroll (boolean value)

public function get CanContentScroll () : boolean

public function set CanContentScroll (value : boolean)

<object CanContentScroll="bool" .../>

Property Value

true if content can scroll; otherwise, false. The default value is true.

Physical scrolling is used to scroll content by a predetermined physical increment, typically by a value that is declared in pixels. Logical scrolling is used to scroll to the next item in the logical tree. 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. For the complete sample, see ScrollChanged Event Sample.

public void scrollTrue(object sender, RoutedEventArgs e)
{
    sv1.CanContentScroll = true;
    sv1.Height = 600;
    myStackPanel.Visibility = Visibility.Visible;
    btn1.Visibility = Visibility.Collapsed;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft