共用方式為


ScrollContentPresenter.CanContentScroll 屬性

定義

如果支援 IScrollInfo 的話,表示是否允許內容控制捲動。

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

屬性值

Boolean

如果允許內容捲動,則為 true,否則為 falsefalse 值表示 ScrollContentPresenter 做為捲動用戶端。 此屬性沒有預設值。

範例

下列範例示範如何在 CanContentScroll XAML) 中使用 Extensible Application Markup Language (屬性。

     <Style TargetType="{x:Type ScrollViewer}">
       <Setter Property="OverridesDefaultStyle" Value="True" />
       <Setter Property="Template">
         <Setter.Value>
           <ControlTemplate TargetType="{x:Type ScrollViewer}">
             <Grid>
               <Grid.ColumnDefinitions>
                 <ColumnDefinition Width="Auto"/>
                 <ColumnDefinition Width="*"/>
               </Grid.ColumnDefinitions>
               <Grid.RowDefinitions>
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="Auto"/>
               </Grid.RowDefinitions>
               <Border Grid.Row="0" Grid.Column="1">
                 <ScrollContentPresenter CanContentScroll="True" Content="{TemplateBinding ScrollViewer.Content}" />
               </Border>
               <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}"/>
             </Grid>
           </ControlTemplate>
         </Setter.Value>
       </Setter>
     </Style>

備註

相依性屬性資訊

識別碼欄位 CanContentScrollProperty
中繼資料屬性設定為 true

適用於