Export (0) Print
Expand All

ScrollContentPresenter::CanContentScroll Property

Indicates whether the content, if it supports IScrollInfo, should be allowed to control scrolling.

Namespace:  System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

property bool CanContentScroll {
	bool get ();
	void set (bool value);
<object CanContentScroll="bool" .../>

Property Value

Type: System::Boolean
true if the content is allowed to scroll; otherwise, false. A false value indicates that the ScrollContentPresenter acts as the scrolling client. This property has no default value.

Identifier field


Metadata properties set to true


The following example demonstrates how to use the CanContentScroll property in Extensible Application Markup Language (XAML).

     <Style TargetType="{x:Type ScrollViewer}">
       <Setter Property="OverridesDefaultStyle" Value="True" />
       <Setter Property="Template">
           <ControlTemplate TargetType="{x:Type ScrollViewer}">
                 <ColumnDefinition Width="Auto"/>
                 <ColumnDefinition Width="*"/>
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="Auto"/>
               <Border Grid.Row="0" Grid.Column="1">
                 <ScrollContentPresenter CanContentScroll="True" Content="{TemplateBinding ScrollViewer.Content}" />
               <ScrollBar Orientation="Vertical" Grid.Row="0" Grid.Column="0" Minimum="0" Maximum="{TemplateBinding ScrollViewer.ScrollableHeight}" Value="{TemplateBinding ScrollViewer.VerticalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportHeight}" Name="PART_VerticalScrollBar" Visibility="{TemplateBinding ScrollViewer.ComputedVerticalScrollBarVisibility}" 
               <ScrollBar Orientation="Horizontal" Grid.Row="1" Grid.Column="1" Minimum="0" Maximum="{TemplateBinding ScrollViewer.ScrollableWidth}" Value="{TemplateBinding ScrollViewer.HorizontalOffset}" ViewportSize="{TemplateBinding ScrollViewer.ViewportWidth}" Name="PART_HorizontalScrollBar" Visibility="{TemplateBinding ScrollViewer.ComputedHorizontalScrollBarVisibility}"/>

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft