ScrollViewer 类

定义

表示可包含其他可视元素的可滚动区域。

public ref class ScrollViewer sealed : ContentControl
public ref class ScrollViewer sealed : ContentControl, IScrollAnchorProvider
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ScrollViewer final : ContentControl
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ScrollViewer final : ContentControl
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ScrollViewer final : ContentControl, IScrollAnchorProvider
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ScrollViewer : ContentControl
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScrollViewer : ContentControl
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ScrollViewer : ContentControl, IScrollAnchorProvider
Public NotInheritable Class ScrollViewer
Inherits ContentControl
Public NotInheritable Class ScrollViewer
Inherits ContentControl
Implements IScrollAnchorProvider
<ScrollViewer .../>
-or-
<ScrollViewer ...>
content
</ScrollViewer>
继承
Object Platform::Object IInspectable DependencyObject UIElement FrameworkElement Control ContentControl ScrollViewer
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

提示

有关详细信息、设计指南和代码示例,请参阅 滚动查看器

WinUI 2 库应用包括大多数 WinUI 2 控件、特性和功能的交互式示例。 通过 Microsoft Store 获取应用,或在 GitHub 上获取源代码。

以下 XAML 在 ScrollViewer 中创建一个大型 TextBlock ,以及用于比较的 TextBlock 的另一个副本。

<StackPanel>
    <!-- A large TextBlock. -->
    <TextBlock Width="300" TextWrapping="Wrap" Margin="0,0,0,30" 
      Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac mi ipsum. Phasellus vel malesuada mauris. Donec pharetra, enim sit amet mattis tincidunt, felis nisi semper lectus, vel porta diam nisi in augue. Pellentesque lacus tortor, aliquam et faucibus id, rhoncus ut justo. Sed id lectus odio, eget pulvinar diam. Suspendisse eleifend ornare libero, in luctus purus aliquet non. Sed interdum, sem vitae rutrum rhoncus, felis ligula ultrices sem, in eleifend eros ante id neque." />
    
    <!-- The same large TextBlock, wrapped in a ScrollViewer. -->
    <ScrollViewer Height="200" Width="200" 
                  HorizontalScrollBarVisibility="Auto" 
                  VerticalScrollBarVisibility="Auto">
        <TextBlock Width="300" TextWrapping="Wrap"
            Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac mi ipsum. Phasellus vel malesuada mauris. Donec pharetra, enim sit amet mattis tincidunt, felis nisi semper lectus, vel porta diam nisi in augue. Pellentesque lacus tortor, aliquam et faucibus id, rhoncus ut justo. Sed id lectus odio, eget pulvinar diam. Suspendisse eleifend ornare libero, in luctus purus aliquet non. Sed interdum, sem vitae rutrum rhoncus, felis ligula ultrices sem, in eleifend eros ante id neque." />
    </ScrollViewer>
</StackPanel>

注解

提示

有关详细信息、设计指南和代码示例,请参阅 滚动查看器控件

ScrollViewer 是一个容器控件,允许用户平移和缩放其内容。

滚动查看器控件

ScrollViewer 能让内容按比其实际大小更小的区域显示。 当 ScrollViewer 的内容不完全可见时,ScrollViewer 将显示用户可用于移动可见内容区域的滚动条。 包含 ScrollViewer 所有内容的区域是盘区。 内容的可见区域是视口。

ScrollViewer 控件作为其他控件复合部分的形式存在是普遍情况。 仅当主机控件的布局空间小于扩展的内容大小时,ScrollViewer 部件以及 ScrollContentPresenter 类才会显示视区以及滚动条。 列表经常会发生此情况,因此 ListViewGridView 模板始终会包括 ScrollViewer。 TextBoxRichEditBox 也在其模板中包括了 ScrollViewer。

当控件中的 ScrollViewer 部件存在时,主机控件通常为某些输入事件和操作提供内置事件处理,使内容能够滚动。 例如, GridView 解释轻扫手势,这会导致内容水平滚动。 主机控件接收的输入事件和原始操作视作由该控件处理,并且低级别事件(例如 PointerPressed)不会引发,也不会浮升到任何父容器。 可以更改某些内置控件处理,方法是覆盖控件类和事件的 OnEvent 虚拟方法,或者重新设置控件的模板。 但这两种情况要重现原始默认行为都不简单,这种行为通常已存在,以便控件以预期方式对事件以及用户输入操作和手势做出反应。 因此应该考虑是否正需要引发该输入事件。 你可能想要调查是否有其他输入事件或手势未通过控件处理,并在应用或控件交互设计中使用它们。

为让包括 ScrollViewer 的控件能够影响 ScrollViewer 部件的某些行为和属性,ScrollViewer 定义了大量能够在样式中设置并在模板绑定中使用的 XAML 附加属性。

如果需要在可滚动视图 ((如 ScrollViewer) )中处理 UIElement 的指针事件,则必须通过调用 UIElement.CancelDirectmanipulation () 显式禁用对视图中元素的操作事件的支持。 若要在该视图中重新启用操作事件,请调用 UIElement.TryStartDirectManipulation()

笔交互

从 Windows 10 版本 1709 (SDK 16299) 开始,UWP 应用中主动笔的默认行为是像触摸、触摸板和被动笔) 一样滚动/平移 (。 ScrollViewer 使用指针事件,除非你指定自己处理事件,并且不希望它们用于操作。

在 1709 之前的 Windows 10 版本中,默认行为是选择文本。

如果你的应用应使用活动笔进行文本选择,你可以替代笔滚动并还原上一行为。 为此,请处理 PointerPressed 事件并设置 ManipulationMode 属性以指定系统不应处理笔交互来滚动main ScrollViewer。 还可以处理 PointerReleasedPointerCanceled 事件,以在删除笔时重新打开默认系统行为。

此示例演示如何:

  • 使用 AddHandler 方法注册事件,并将 handledEventsToo 参数设置为 true
  • 检查指针设备是否为 触控笔
  • PointerPressed 事件处理程序中,关闭 ScrollViewer 中的系统操作支持。
  • PointerReleasedPointerCanceled 事件处理程序中,重新启用系统操作支持。
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ScrollViewer x:Name="myScrollViewer">
        <Image Source="Assets/StoreLogo.png"/>
    </ScrollViewer>
</Grid>
public MainPage()
{
    this.InitializeComponent();

    this.myScrollViewer.AddHandler(UIElement.PointerPressedEvent, 
        new PointerEventHandler(myScrollViewer_PointerPressed), 
        true /*handledEventsToo*/);
    this.myScrollViewer.AddHandler(UIElement.PointerReleasedEvent, 
        new PointerEventHandler(myScrollViewer_PointerReleased), 
        true /*handledEventsToo*/);
    this.myScrollViewer.AddHandler(UIElement.PointerCanceledEvent, 
        new PointerEventHandler(myScrollViewer_PointerCanceled), 
        true /*handledEventsToo*/);
}

private void myScrollViewer_PointerPressed(object sender, PointerRoutedEventArgs e)
{
    if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen)
    {
        (myScrollViewer.Content as UIElement).ManipulationMode &= ~ManipulationModes.System;
    }
}

private void myScrollViewer_PointerReleased(object sender, PointerRoutedEventArgs e)
{
    if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen)
    {
        (myScrollViewer.Content as UIElement).ManipulationMode |= ManipulationModes.System;
    }
}

private void myScrollViewer_PointerCanceled(object sender, PointerRoutedEventArgs e)
{
    if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Pen)
    {
        (myScrollViewer.Content as UIElement).ManipulationMode |= ManipulationModes.System;
    }
}

ScrollViewer XAML 附加属性

ScrollViewer 定义以下 XAML 附加属性:

这些 XAML 附加属性适用于 ScrollViewer 是隐式的,例如 ScrollViewer 存在于 ListViewGridView 的默认模板中,并且你希望能够在不访问模板部件的情况下影响控件的滚动行为。 对于 ScrollViewer 在 XAML 中显式的情况(如示例部分的示例代码所示),无需使用附加属性语法。 只需使用属性语法,例如 <ScrollViewer ZoomMode="Enabled" />

为了支持 XAML 处理器对附加属性的访问,以及向代码公开等效的 get 和 set 操作,每个 XAML 附加属性都有一对 GetSet 访问器方法。 例如, GetHorizontalScrollModeSetHorizontalScrollMode 方法支持并为 ScrollViewer.HorizontalScrollMode 提供等效的仅代码支持。 或者,可以使用依赖属性系统来获取或设置附加属性的值。 调用 GetValueSetValue,传递要设置的依赖属性标识符的参数,以及对其获取或设置值的目标对象的引用。

控件样式和模板

可以修改默认 的 StyleControlTemplate ,为控件提供唯一的外观。 有关修改控件的样式和模板的信息,请参阅 设置控件样式。 文件中包含 generic.xaml 定义控件外观的默认样式、模板和资源。 出于设计目的, generic.xaml 可通过 SDK 或 NuGet 包安装在本地使用。

  • 建议) (WinUI 样式 有关 WinUI 中更新的样式,请参阅 \Users\<username>\.nuget\packages\microsoft.ui.xaml\<version>\lib\uap10.0\Microsoft.UI.Xaml\Themes\generic.xaml
  • 非 WinUI 样式: 有关内置样式,请参阅 %ProgramFiles(x86)%\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic\generic.xaml

如果自定义安装,位置可能会有所不同。 不同版本的 SDK 的样式和资源可能具有不同的值。

XAML 还包括可用于在不修改控件模板的情况下修改不同视觉状态下控件颜色的资源。 修改这些资源优先于设置 背景前台等属性。 有关详细信息,请参阅 XAML 样式一文的轻量级样式部分。 从 Windows 10 版本 1607 (SDK 14393) 开始提供轻量级样式资源。

Windows 8 行为

由跟踪板设备进行的手势处理

对于Windows 8,由 ScrollViewer 控件部件输入处理的跟踪板设备手势被解释为鼠标滚轮输入,因此会触发 PointerWheelChanged 事件。 从Windows 8.1开始,ScrollViewer 使用基础操作逻辑,该逻辑将跟踪板手势解释为 ScrollViewer 响应的操作,因此该手势被视为由控件处理,并且不会再触发 PointerWheelChanged 事件。

如果将应用代码从Windows 8迁移到Windows 8.1可能需要考虑此行为更改,因为它会导致在更少的情况下触发 PointerWheelChanged。 此外,ScrollViewer 现在内置的行为可能会复制处理程序本来会执行的操作。

对于针对 Windows 8 编译的应用,如果它在 Windows 8.1 上运行,将继续使用 Windows 8 行为。

屏幕键盘的应用 UI

Windows 8具有内部实现的逻辑,每当用户调用屏幕键盘时,该逻辑都会将 ScrollViewer 与整个应用 UI 相关联。 此屏幕键盘是用户通过轻松访问中心请求的特定辅助功能。 如果系统未检测到任何键盘设备,则它与可在应用 UI 中显示的文本输入控件软键盘不同。 如果由于键盘占用 UI 空间而强制滚动应用,则内部 ScrollViewer 在此处的作用是可以滚动应用所在的区域。

从Windows 8.1开始,出现屏幕键盘时,系统仍具有 UI/布局行为,但不再使用此内部创建的 ScrollViewer。 相反,它使用应用代码无法更改或检查的专用内部控制。

此行为更改的大多数方面根本不影响应用。 但是,你的应用可能已预料到此行为:为 ScrollViewer 提供用于更改布局的隐式 样式 ,或者通过使用 VisualTreeHelper 在树中行走来查找此内部创建的 ScrollViewer 并在运行时对其进行更改。 对于为Windows 8.1编译的应用,该代码将不起作用。

对于针对 Windows 8 编译的应用,如果它在 Windows 8.1 上运行,将继续使用 Windows 8 行为。

版本历史记录

Windows 版本 SDK 版本 已添加值
1809 17763 AnchorRequested
1809 17763 CanContentRenderOutsideBounds
1809 17763 CurrentAnchor
1809 17763 GetCanContentRenderOutsideBounds
1809 17763 HorizontalAnchorRatio
1809 17763 ReduceViewportForCoreInputViewOcclusions
1809 17763 RegisterAnchorCandidate
1809 17763 SetCanContentRenderOutsideBounds
1809 17763 UnregisterAnchorCandidate
1809 17763 VerticalAnchorRatio

构造函数

ScrollViewer()

初始化 ScrollViewer 类的新实例。

属性

AccessKey

获取或设置此元素的访问键 (助记) 。

(继承自 UIElement)
AccessKeyScopeOwner

获取或设置一个源元素,该元素提供此元素的访问键范围,即使它不在源元素的可视化树中也是如此。

(继承自 UIElement)
ActualHeight

获取 FrameworkElement 的呈现高度。 请参阅“备注”。

(继承自 FrameworkElement)
ActualOffset

获取此 UIElement 相对于其父级的位置,该位置在布局过程的排列过程期间计算。

(继承自 UIElement)
ActualSize

获取此 UIElement 在布局过程的排列过程中计算的大小。

(继承自 UIElement)
ActualTheme

获取元素当前使用的 UI 主题,该主题可能与 RequestedTheme 不同。

(继承自 FrameworkElement)
ActualWidth

获取 FrameworkElement 的呈现宽度。 请参阅“备注”。

(继承自 FrameworkElement)
AllowDrop

获取或设置一个值,该值确定此 UIElement 是否可以作为拖放操作的放置目标。

(继承自 UIElement)
AllowFocusOnInteraction

获取或设置一个值,该值指示当用户与元素交互时是否自动获取焦点。

(继承自 FrameworkElement)
AllowFocusWhenDisabled

获取或设置禁用的控件是否可以接收焦点。

(继承自 FrameworkElement)
Background

获取或设置提供控件背景的画笔。

(继承自 Control)
BackgroundSizing

获取或设置一个值,该值指示背景相对于此元素边框的延伸程度。

(继承自 Control)
BaseUri

获取统一资源标识符 (URI) ,表示 XAML 加载时 XAML 构造对象的基本统一资源标识符 (URI) 。 此属性在运行时用于统一资源标识符 (URI) 解析。

(继承自 FrameworkElement)
BorderBrush

获取或设置描述控件边框填充的画笔。

(继承自 Control)
BorderThickness

获取或设置控件的边框宽度。

(继承自 Control)
BringIntoViewOnFocusChange

获取或设置一个值,该值确定当视图中的项获得焦点时 ScrollViewer 是否使用引入视图滚动行为。

BringIntoViewOnFocusChangeProperty

标识 BringIntoViewOnFocusChange 依赖属性。

CacheMode

获取或设置一个值,该值指示应尽可能将呈现的内容缓存为复合位图。

(继承自 UIElement)
CanBeScrollAnchor

获取或设置一个值,该值指示 UIElement 是否可以成为滚动定位的候选项。

(继承自 UIElement)
CanContentRenderOutsideBounds

获取或设置一个值,该值指示滚动内容是否可以在 ScrollViewer 的边界之外呈现。

CanContentRenderOutsideBoundsProperty

标识 CanContentRenderOutsideBounds 依赖属性。

CanDrag

获取或设置一个值,该值指示是否可以在拖放操作中将元素作为数据拖动。

(继承自 UIElement)
CenterPoint

获取或设置 元素的中心点,该中心点是关于发生旋转或缩放的点。 影响元素的呈现位置。

(继承自 UIElement)
CharacterSpacing

获取或设置字符之间的统一间距,单位为 1/1000 em。

(继承自 Control)
Clip

获取或设置用于定义 UIElement 内容的大纲的 RectangleGeometry

(继承自 UIElement)
CompositeMode

获取或设置一个属性,该属性声明元素在其父布局和窗口中的替代组合和混合模式。 这与混合 XAML/Microsoft DirectX UI 中涉及的元素相关。

(继承自 UIElement)
ComputedHorizontalScrollBarVisibility

获取一个值,该值指示水平 ScrollBar 是否可见。

ComputedHorizontalScrollBarVisibilityProperty

标识 ComputedHorizontalScrollBarVisibility 依赖属性。

ComputedVerticalScrollBarVisibility

获取一个值,该值指示垂直 滚动条 是否可见。

ComputedVerticalScrollBarVisibilityProperty

标识 ComputedVerticalScrollBarVisibility 依赖属性。

Content

获取或设置 ContentControl 的内容。

(继承自 ContentControl)
ContentTemplate

获取或设置用于显示 ContentControl 内容的数据模板。

(继承自 ContentControl)
ContentTemplateRoot

获取 ContentTemplate 属性指定的数据模板的根元素。

(继承自 ContentControl)
ContentTemplateSelector

获取或设置一个选择对象,该对象根据在运行时处理有关内容项或其容器的信息,将 DataTemplate 更改为适用于内容。

(继承自 ContentControl)
ContentTransitions

获取或设置应用于 ContentControl 内容的 Transition 样式元素的集合。

(继承自 ContentControl)
ContextFlyout

获取或设置与此元素关联的浮出控件。

(继承自 UIElement)
CornerRadius

获取或设置控件边框角的半径。

(继承自 Control)
CurrentAnchor

当前选择的用于滚动定位的定位点元素。

DataContext

获取或设置 FrameworkElement 的数据上下文。 数据上下文的常见用途是 当 FrameworkElement 使用 {Binding} 标记扩展并参与数据绑定时。

(继承自 FrameworkElement)
DefaultStyleKey

获取或设置引用控件的默认样式的键。 自定义控件的作者使用此属性更改其控件使用的样式的默认值。

(继承自 Control)
DefaultStyleResourceUri

获取或设置包含控件的默认样式的资源文件的路径。

(继承自 Control)
DesiredSize

获取此 UIElement 在布局过程的度量传递期间计算的大小。

(继承自 UIElement)
Dispatcher

获取与此对象关联的 CoreDispatcherCoreDispatcher 表示可以访问 UI 线程上的 DependencyObject 的工具,即使代码是由非 UI 线程启动的。

(继承自 DependencyObject)
ElementSoundMode

获取或设置一个值,该值指定控件是否播放声音的首选项。

(继承自 Control)
ExitDisplayModeOnAccessKeyInvoked

获取或设置一个值,该值指定在调用访问密钥时是否消除访问密钥显示。

(继承自 UIElement)
ExtentHeight

获取 ScrollViewer 中所有可滚动内容的垂直大小。

ExtentHeightProperty

ExtentHeight 依赖属性的标识符。

ExtentWidth

获取 ScrollViewer 中所有可滚动内容的水平大小。

ExtentWidthProperty

ExtentWidth 依赖属性的标识符。

FlowDirection

获取或设置文本和其他 UI 元素在控制其布局的任何父元素中的流动方向。 此属性可以设置为 LeftToRightRightToLeft。 在任何元素上将 FlowDirection 设置为 RightToLeft 会将对齐方式设置为右对齐,将阅读顺序设置为从右到左,并将控件的布局设置为从右到左流动。

(继承自 FrameworkElement)
FocusState

获取一个值,该值指定此控件是否具有焦点,以及获取焦点的模式。

(继承自 Control)
FocusVisualMargin

获取或设置 FrameworkElement 的焦点视觉对象的外部边距。

(继承自 FrameworkElement)
FocusVisualPrimaryBrush

获取或设置用于为 FrameworkElement 绘制或Reveal焦点视觉对象的外边框HighVisibility的画笔。

(继承自 FrameworkElement)
FocusVisualPrimaryThickness

获取或设置 FrameworkElementHighVisibilityReveal焦点视觉对象的外边框的粗细。

(继承自 FrameworkElement)
FocusVisualSecondaryBrush

获取或设置用于为 FrameworkElement 绘制或Reveal焦点视觉对象的内边框HighVisibility的画笔。

(继承自 FrameworkElement)
FocusVisualSecondaryThickness

获取或设置 FrameworkElementHighVisibilityReveal焦点视觉对象的内边框的粗细。

(继承自 FrameworkElement)
FontFamily

获取或设置用于显示控件中的文本的字体。

(继承自 Control)
FontSize

获取或设置此控件中文本的大小。

(继承自 Control)
FontStretch

获取或设置字体在屏幕上紧缩或加宽的程度。

(继承自 Control)
FontStyle

获取或设置呈现文本的样式。

(继承自 Control)
FontWeight

获取或设置指定字体的粗细。

(继承自 Control)
Foreground

获取或设置一个用于描述前景色的画笔。

(继承自 Control)
Height

获取或设置 FrameworkElement 的建议高度。

(继承自 FrameworkElement)
HighContrastAdjustment

获取或设置一个值,该值指示框架是否在启用高对比度主题时自动调整元素的视觉属性。

(继承自 UIElement)
HorizontalAlignment

获取或设置在布局父级(如面板或项控件)中组合时应用于 FrameworkElement 的水平对齐特征。

(继承自 FrameworkElement)
HorizontalAnchorRatio

确定 ScrollViewer 的 定位点 相对于视区的水平位置。 默认情况下,ScrollViewer 通过在离定位点最近的视区中标识元素来选择元素作为其 CurrentAnchor

HorizontalAnchorRatioProperty

标识 HorizontalAnchorRatio 依赖属性。

HorizontalContentAlignment

获取或设置控件内容的水平对齐方式。

(继承自 Control)
HorizontalOffset

获取内容水平滚动的距离。

HorizontalOffsetProperty

标识 HorizontalOffset 依赖属性。

HorizontalScrollBarVisibility

获取或设置一个值,该值指示是否应显示水平 ScrollBar

HorizontalScrollBarVisibilityProperty

标识 HorizontalScrollBarVisibility 依赖属性。

HorizontalScrollMode

获取或设置一个值,该值确定操作输入如何影响水平轴上的滚动行为。

HorizontalScrollModeProperty

标识 HorizontalScrollMode 依赖属性。

HorizontalSnapPointsAlignment

获取或设置一个值,该值指示现有对齐点与初始视区的水平对齐方式。

HorizontalSnapPointsAlignmentProperty

标识 HorizontalSnapPointsAlignment 依赖属性。

HorizontalSnapPointsType

获取或设置一个值,该值声明操作行为如何响应沿水平轴的吸附点。

HorizontalSnapPointsTypeProperty

标识 HorizontalSnapPointsType 依赖属性。

IsAccessKeyScope

获取或设置一个值,该值指示元素是否定义其自己的访问键范围。

(继承自 UIElement)
IsDeferredScrollingEnabled

获取或设置一个值,该值确定 ScrollViewer 的延迟滚动行为。

IsDeferredScrollingEnabledProperty

标识 IsDeferredScrollingEnabled 依赖属性。

IsDoubleTapEnabled

获取或设置一个值,该值确定 DoubleTapped 事件是否可以源自该元素。

(继承自 UIElement)
IsEnabled

获取或设置一个值,该值指示用户是否可以与控件交互。

(继承自 Control)
IsFocusEngaged

获取或设置一个值,该值指示焦点是否受限于游戏板/远程交互) 的控制边界 (。

(继承自 Control)
IsFocusEngagementEnabled

获取或设置一个值,该值指示是否可以在游戏板/远程交互) (控制边界内限制焦点。

(继承自 Control)
IsHitTestVisible

获取或设置此 UIElement 的包含区域是否可以为命中测试返回 true 值。

(继承自 UIElement)
IsHoldingEnabled

获取或设置一个值,该值确定 Holding 事件是否可以源自该元素。

(继承自 UIElement)
IsHorizontalRailEnabled

获取或设置一个值,该值指示是否为水平轴启用滚动条。

IsHorizontalRailEnabledProperty

标识 IsHorizontalRailEnabled 依赖属性。

IsHorizontalScrollChainingEnabled

获取或设置一个值,该值指示是否为水平轴启用从此子级到父轴的滚动链接。

IsHorizontalScrollChainingEnabledProperty

标识 IsHorizontalScrollChainingEnabled 依赖属性。

IsLoaded

获取一个值,该值指示元素是否已添加到元素树中并已准备好进行交互。

(继承自 FrameworkElement)
IsRightTapEnabled

获取或设置一个值,该值确定 RightTapped 事件是否可以源自该元素。

(继承自 UIElement)
IsScrollInertiaEnabled

获取或设置一个值,该值指示滚动操作是否应在其行为和值中包含惯性。

IsScrollInertiaEnabledProperty

标识 IsScrollInertiaEnabled 依赖属性。

IsTabStop

获取或设置一个值,该值指示是否将某个控件包含在 Tab 导航中。

(继承自 Control)
IsTapEnabled

获取或设置一个值,该值确定 点击 事件是否可以源自该元素。

(继承自 UIElement)
IsTextScaleFactorEnabled

获取或设置是否启用自动文本放大,以反映系统文本大小设置。

(继承自 Control)
IsVerticalRailEnabled

获取或设置一个值,该值指示是否为垂直轴启用滚动条。

IsVerticalRailEnabledProperty

标识 IsVerticalRailEnabled 依赖属性。

IsVerticalScrollChainingEnabled

获取或设置一个值,该值指示是否为纵坐标轴启用从此子级到父级的滚动链接。

IsVerticalScrollChainingEnabledProperty

标识 IsVerticalScrollChainingEnabled 依赖属性。

IsZoomChainingEnabled

获取或设置一个值,该值指示是否启用从此子级到其父级的缩放链接。

IsZoomChainingEnabledProperty

标识 IsZoomChainingEnabled 依赖属性。

IsZoomInertiaEnabled

获取或设置一个值,该值指示缩放操作的行为和值中是否应包括惯性。

IsZoomInertiaEnabledProperty

标识 IsZoomInertiaEnabled 依赖属性。

KeyboardAcceleratorPlacementMode

获取或设置一个值,该值指示控件 工具提示 是否显示其关联键盘快捷键的组合。

(继承自 UIElement)
KeyboardAcceleratorPlacementTarget

获取或设置一个值,该值指示显示快捷键组合的控件 工具提示

(继承自 UIElement)
KeyboardAccelerators

获取使用键盘调用操作的组合键的集合。

加速键通常分配给按钮或菜单项。

显示各种菜单项的键盘快捷键的菜单示例
显示各种菜单项的键盘快捷键的菜单示例

(继承自 UIElement)
KeyTipHorizontalOffset

获取或设置一个值,该值指示键提示相对于 UIElement 的左或右放置位置。

(继承自 UIElement)
KeyTipPlacementMode

获取或设置一个值,该值指示访问键提示相对于 UIElement 边界放置的位置。

(继承自 UIElement)
KeyTipTarget

获取或设置一个值,该值指示访问键提示所针对的元素。

(继承自 UIElement)
KeyTipVerticalOffset

获取或设置一个值,该值指示键提示相对于 UI 元素向上或向下放置的距离。

(继承自 UIElement)
Language

获取或设置适用于 FrameworkElement 以及对象表示形式和 UI 中当前 FrameworkElement 的所有子元素的本地化/全球化语言信息。

(继承自 FrameworkElement)
LeftHeader

获取或设置左侧标题的内容。

LeftHeaderProperty

标识 LeftHeader 依赖属性。

Lights

获取附加到此元素的 XamlLight 对象的集合。

(继承自 UIElement)
ManipulationMode

获取或设置用于 UIElement 行为和与手势交互的 ManipulationModes 值。 通过设置此值,可以在应用代码中处理此元素中的操作事件。

(继承自 UIElement)
Margin

获取或设置 FrameworkElement 的外部边距。

(继承自 FrameworkElement)
MaxHeight

获取或设置 FrameworkElement 的最大高度约束。

(继承自 FrameworkElement)
MaxWidth

获取或设置 FrameworkElement 的最大宽度约束。

(继承自 FrameworkElement)
MaxZoomFactor

获取或设置一个值,该值指示 ZoomFactor 允许的最大运行时值。

MaxZoomFactorProperty

标识 MaxZoomFactor 依赖属性。

MinHeight

获取或设置 FrameworkElement 的最小高度约束。

(继承自 FrameworkElement)
MinWidth

获取或设置 FrameworkElement 的最小宽度约束。

(继承自 FrameworkElement)
MinZoomFactor

获取或设置一个值,该值指示 ZoomFactor 允许的最小运行时值。

MinZoomFactorProperty

标识 MinZoomFactor 依赖属性。

Name

获取或设置对象的标识名称。 当 XAML 处理器从 XAML 标记创建对象树时,运行时代码可以按此名称引用 XAML 声明的对象。

(继承自 FrameworkElement)
Opacity

获取或设置对象的不透明度程度。

(继承自 UIElement)
OpacityTransition

获取或设置对 Opacity 属性的更改进行动画处理的 ScalarTransition。

(继承自 UIElement)
Padding

获取或设置控件内部的填充边距。

(继承自 Control)
Parent

获取对象树中此 FrameworkElement 的父对象。

(继承自 FrameworkElement)
PointerCaptures

获取所有捕获的指针的集合,表示为 Pointer 值。

(继承自 UIElement)
Projection

获取或设置呈现此元素时要应用的透视投影 (三维效果) 。

(继承自 UIElement)
ReduceViewportForCoreInputViewOcclusions

获取或设置一个值,该值指示 ScrollViewer 是否应尝试调整其内容,使其在停靠的 CoreInputView 遮挡部分内容时保持可见。

ReduceViewportForCoreInputViewOcclusionsProperty

标识 ReduceViewportForCoreInputViewOcclusions 依赖属性。

RenderSize

获取 UIElement 的最终呈现大小。 不建议使用 ,请参阅备注。

(继承自 UIElement)
RenderTransform

获取或设置影响 UIElement 呈现位置的转换信息。

(继承自 UIElement)
RenderTransformOrigin

获取或设置 RenderTransform 声明的任何可能的呈现转换相对于 UIElement 边界的原点。

(继承自 UIElement)
RequestedTheme

获取或设置 UIElement (使用的 UI 主题及其子元素) 用于资源确定。 使用 RequestedTheme 指定的 UI 主题可以替代应用级 RequestedTheme

(继承自 FrameworkElement)
RequiresPointer

获取或设置 UI 元素是否支持鼠标模式,该模式模拟非指针输入设备(如游戏板或遥控器)的指针交互体验。

(继承自 Control)
Resources

获取本地定义的资源字典。 在 XAML 中,可以通过 XAML 隐式集合语法将资源项建立为属性元素的 frameworkElement.Resources 子对象元素。

(继承自 FrameworkElement)
Rotation

获取或设置顺时针旋转的角度(以度为单位)。 相对于 RotationAxis 和 CenterPoint 旋转。 影响元素的呈现位置。

(继承自 UIElement)
RotationAxis

获取或设置要围绕元素旋转的轴。

(继承自 UIElement)
RotationTransition

获取或设置对 Rotation 属性的更改进行动画处理的 ScalarTransition。

(继承自 UIElement)
Scale

获取或设置元素的刻度。 相对于元素的 CenterPoint 缩放。 影响元素的呈现位置。

(继承自 UIElement)
ScaleTransition

获取或设置对 Scale 属性的更改进行动画处理的 Vector3Transition。

(继承自 UIElement)
ScrollableHeight

获取一个值,该值表示可滚动的区域的垂直大小;盘区高度与视区高度之间的差值。

ScrollableHeightProperty

标识 ScrollableHeight 依赖属性。

ScrollableWidth

获取一个值,该值表示可滚动的区域的水平大小;范围宽度与视区宽度之间的差异。

ScrollableWidthProperty

标识 ScrollableWidth 依赖属性。

Shadow

获取或设置元素投射的阴影效果。

(继承自 UIElement)
Style

获取或设置在布局和呈现期间为此对象应用的实例 Style

(继承自 FrameworkElement)
TabFocusNavigation

获取或设置一个值,该值修改 Tabbing 和 TabIndex 对此控件的工作方式。

(继承自 UIElement)
TabIndex

获取或设置一个值,该值指示当用户使用 Tab 键浏览应用 UI 时元素接收焦点的顺序。

(继承自 Control)
TabNavigation

获取或设置一个值,该值修改 tabbing 和 TabIndex 对此控件的工作方式。

注意

对于Windows 10 创意者更新 (内部版本 10.0.15063) 及更新版本,TabFocusNavigation 属性在 UIElement 基类上可用,以包括选项卡序列中不使用 ControlTemplate 的对象

(继承自 Control)
Tag

获取或设置可用于存储有关此对象的自定义信息的任意对象值。

(继承自 FrameworkElement)
Template

获取或设置控件模板。 控件模板在 UI 中定义控件的视觉外观,并在 XAML 标记中定义。

(继承自 Control)
TopHeader

获取或设置顶部标头的内容。

TopHeaderProperty

标识 TopHeader 依赖属性。

TopLeftHeader

获取或设置顶部、左侧标题的内容。

TopLeftHeaderProperty

标识 TopLeftHeader 依赖属性。

Transform3D

获取或设置呈现此元素时要应用的三维转换效果。

(继承自 UIElement)
TransformMatrix

获取或设置要应用于元素的转换矩阵。

(继承自 UIElement)
Transitions

获取或设置应用于 UIElementTransition 样式元素的集合。

(继承自 UIElement)
Translation

获取或设置元素的 x、y 和 z 呈现位置。

(继承自 UIElement)
TranslationTransition

获取或设置对 Translation 属性的更改进行动画处理的 Vector3Transition。

(继承自 UIElement)
Triggers

获取为 FrameworkElement 定义的动画触发器的集合。 不常用。 请参阅“备注”。

(继承自 FrameworkElement)
UIContext

获取 元素的上下文标识符。

(继承自 UIElement)
UseLayoutRounding

获取或设置一个值,该值确定对象及其可视子树的呈现是否应使用使呈现与整个像素对齐的舍入行为。

(继承自 UIElement)
UseSystemFocusVisuals

获取或设置一个值,该值指示控件是使用系统绘制的焦点视觉对象还是控件模板中定义的视觉对象。

(继承自 Control)
VerticalAlignment

获取或设置在父对象(如面板或项控件)中组合时应用于 FrameworkElement 的垂直对齐特征。

(继承自 FrameworkElement)
VerticalAnchorRatio

确定 ScrollViewer 的 定位点 相对于视口的垂直位置。 默认情况下,ScrollViewer 通过在离定位点最近的视区中标识元素来选择元素作为其 CurrentAnchor

VerticalAnchorRatioProperty

标识 VerticalAnchorRatio 依赖属性。

VerticalContentAlignment

获取或设置控件内容的垂直对齐方式。

(继承自 Control)
VerticalOffset

获取内容垂直滚动的距离。

VerticalOffsetProperty

标识 VerticalOffset 依赖属性。

VerticalScrollBarVisibility

获取或设置一个值,该值指示是否应显示垂直 ScrollBar

VerticalScrollBarVisibilityProperty

标识 VerticalScrollBarVisibility 依赖属性。

VerticalScrollMode

获取或设置一个值,该值确定操作输入如何影响垂直轴上的滚动行为。

VerticalScrollModeProperty

标识 VerticalScrollMode 依赖属性。

VerticalSnapPointsAlignment

获取或设置一个值,该值指示现有对齐点与初始视区垂直对齐的方式。

VerticalSnapPointsAlignmentProperty

标识 VerticalSnapPointsAlignment 依赖属性。

VerticalSnapPointsType

获取或设置一个值,该值声明操作行为如何响应垂直轴上的对齐点。

VerticalSnapPointsTypeProperty

标识 VerticalSnapPointsType 依赖属性。

ViewportHeight

获取可查看内容的垂直大小。

ViewportHeightProperty

标识 ViewportHeight 依赖属性。

ViewportWidth

获取可查看内容的水平大小。

ViewportWidthProperty

标识 ViewportWidth 依赖属性。

Visibility

获取或设置 UIElement 的可见性。 不可见的 UIElement 不会呈现,也不会将其所需大小传达给布局。

(继承自 UIElement)
Width

获取或设置 FrameworkElement 的宽度。

(继承自 FrameworkElement)
XamlRoot

获取或设置 XamlRoot 在其中查看此元素的 。

(继承自 UIElement)
XYFocusDown

获取或设置当用户按下方向键 (方向键) 时获取焦点的对象。

(继承自 Control)
XYFocusDownNavigationStrategy

获取或设置一个值,该值指定用于确定向下导航的目标元素的策略。

(继承自 UIElement)
XYFocusKeyboardNavigation

获取或设置一个值,该值使用键盘方向箭头启用或禁用导航。

(继承自 UIElement)
XYFocusLeft

获取或设置当用户向左按方向键 (方向键时获取焦点的对象) 。

(继承自 Control)
XYFocusLeftNavigationStrategy

获取或设置一个值,该值指定用于确定左侧导航的目标元素的策略。

(继承自 UIElement)
XYFocusRight

获取或设置当用户向右按方向键 (方向键时获取焦点的对象) 。

(继承自 Control)
XYFocusRightNavigationStrategy

获取或设置一个值,该值指定用于确定右侧导航的目标元素的策略。

(继承自 UIElement)
XYFocusUp

获取或设置当用户按下方向键 (方向键) 时获取焦点的对象。

(继承自 Control)
XYFocusUpNavigationStrategy

获取或设置一个值,该值指定用于确定向上导航的目标元素的策略。

(继承自 UIElement)
ZoomFactor

获取一个值,该值指示当前用于内容缩放的缩放因子。

ZoomFactorProperty

标识 ZoomFactor 依赖属性。

ZoomMode

获取或设置一个值,该值指示是否启用 ScrollViewer 内容中的缩放行为。

ZoomModeProperty

标识 ZoomMode 依赖属性。

ZoomSnapPoints

获取 ScrollViewer 持有的缩放对齐点因子的可观测集合。

ZoomSnapPointsProperty

标识 ZoomSnapPoints 依赖属性。

ZoomSnapPointsType

获取或设置一个值,该值指示如何处理交互输入的缩放贴靠点。

ZoomSnapPointsTypeProperty

标识 ZoomSnapPointsType 依赖属性。

方法

AddHandler(RoutedEvent, Object, Boolean)

为指定的路由事件添加路由事件处理程序,并将该处理程序添加到当前元素的处理程序集合中。 将 handledEventsToo 指定为 true 以调用提供的处理程序,即使在其他位置处理事件也是如此。

(继承自 UIElement)
ApplyTemplate()

加载相关的控件模板,以便可以引用其部件。

(继承自 Control)
Arrange(Rect)

定位子对象并确定 UIElement 的大小。 为其子元素实现自定义布局的父对象应从其布局重写实现中调用此方法,以形成递归布局更新。

(继承自 UIElement)
ArrangeOverride(Size)

提供布局的“排列”传递的行为。 类可以重写此方法,以定义自己的“排列”传递行为。

(继承自 FrameworkElement)
CancelDirectManipulations()

取消正在进行的直接操作处理, (系统定义的平移/缩放) 包含当前 UIElement 的任何 ScrollViewer 父级。

(继承自 UIElement)
CapturePointer(Pointer)

将指针捕获设置为 UIElement。 捕获后,只有具有捕获的元素才会触发与指针相关的事件。

(继承自 UIElement)
ChangeView(IReference<Double>, IReference<Double>, IReference<Single>)

使 ScrollViewer 使用指定的偏移量和缩放因子将新视图加载到视区中。

ChangeView(IReference<Double>, IReference<Double>, IReference<Single>, Boolean)

使 ScrollViewer 使用指定的偏移量和缩放系数将新视图加载到视区中,并选择性地禁用滚动动画。

ClearValue(DependencyProperty)

清除依赖属性的本地值。

(继承自 DependencyObject)
FindName(String)

检索具有指定标识符名称的对象。

(继承自 FrameworkElement)
FindSubElementsForTouchTargeting(Point, Rect)

使 UIElement 子类能够公开有助于解析触摸目标的子元素。

(继承自 UIElement)
Focus(FocusState)

尝试在控件上设置焦点。

(继承自 Control)
GetAnimationBaseValue(DependencyProperty)

返回为依赖属性建立的任何基值,该基值适用于动画未处于活动状态的情况。

(继承自 DependencyObject)
GetBindingExpression(DependencyProperty)

返回 BindingExpression ,它代表指定属性上的绑定。

(继承自 FrameworkElement)
GetBringIntoViewOnFocusChange(DependencyObject)

从指定元素获取 BringIntoViewOnFocusChange 依赖属性/ ScrollViewer.BringIntoViewOnFocusChange XAML 附加属性的值。

GetCanContentRenderOutsideBounds(DependencyObject)

获取指定元素上的 CanContentRenderOutsideBounds 依赖属性/ ScrollViewer.CanContentRenderOutsideBounds XAML 附加属性的值。

GetChildrenInTabFocusOrder()

允许 UIElement 子类公开参与 Tab 焦点的子元素。

(继承自 UIElement)
GetHorizontalScrollBarVisibility(DependencyObject)

从指定元素获取 HorizontalScrollBarVisibility 依赖属性/ ScrollViewer.HorizontalScrollBarVisibility XAML 附加属性的值。

GetHorizontalScrollMode(DependencyObject)

从指定元素获取 HorizontalScrollMode 依赖属性/ ScrollViewer.HorizontalScrollMode XAML 附加属性的值。

GetIsDeferredScrollingEnabled(DependencyObject)

从指定元素获取 IsDeferredScrollingEnabled 依赖属性/ ScrollViewer.IsDeferredScrollingInertiaEnabled XAML 附加属性的值。

GetIsHorizontalRailEnabled(DependencyObject)

从指定元素获取 IsHorizontalRailEnabled 依赖属性/ ScrollViewer.IsHorizontalRailEnabled XAML 附加属性的值。

GetIsHorizontalScrollChainingEnabled(DependencyObject)

从指定元素获取 IsHorizontalScrollChainingEnabled 依赖属性/ ScrollViewer.IsHorizontalScrollChainingEnabled XAML 附加属性的值。

GetIsScrollInertiaEnabled(DependencyObject)

从指定元素获取 IsScrollInertiaEnabled 依赖属性/ ScrollViewer.IsScrollInertiaEnabled XAML 附加属性的值。

GetIsVerticalRailEnabled(DependencyObject)

从指定元素获取 IsVerticalRailEnabled 依赖属性/ ScrollViewer.IsVerticalRailEnabled XAML 附加属性的值。

GetIsVerticalScrollChainingEnabled(DependencyObject)

从指定元素获取 IsVerticalScrollChainingEnabled 依赖属性/ ScrollViewer.IsVerticalScrollChainingEnabled XAML 附加属性的值。

GetIsZoomChainingEnabled(DependencyObject)

从指定元素获取 IsZoomChainingEnabled 依赖属性/ ScrollViewer.IsZoomChainingEnabled XAML 附加属性的值。

GetIsZoomInertiaEnabled(DependencyObject)

从指定元素获取 IsZoomInertiaEnabled 依赖属性/ ScrollViewer.IsZoomInertiaEnabled XAML 附加属性的值。

GetTemplateChild(String)

检索实例化 ControlTemplate 可视化树中的命名元素。

(继承自 Control)
GetValue(DependencyProperty)

DependencyObject 返回依赖属性的当前有效值。

(继承自 DependencyObject)
GetVerticalScrollBarVisibility(DependencyObject)

从指定元素获取 VerticalScrollBarVisibility 依赖属性/ ScrollViewer.VerticalScrollBarVisibility XAML 附加属性的值。

GetVerticalScrollMode(DependencyObject)

从指定元素获取 VerticalScrollMode 依赖属性/ ScrollViewer.VerticalScrollMode XAML 附加属性的值。

GetZoomMode(DependencyObject)

从指定元素获取 ZoomMode 依赖属性/ ScrollViewer.ZoomMode XAML 附加属性的值。

GoToElementStateCore(String, Boolean)

在派生类中实现时,在代码中为控件模板启用可视化树的按状态构造,而不是在控件启动时加载所有状态的 XAML。

(继承自 FrameworkElement)
InvalidateArrange()

使 UIElement 的排列状态 (布局) 无效。 无效后, UIElement 将更新其布局,这将异步发生。

(继承自 UIElement)
InvalidateMeasure()

使 UIElement 的度量状态 (布局) 无效。

(继承自 UIElement)
InvalidateScrollInfo()

当描述滚动区域的大小和位置的属性的值更改时调用。

InvalidateViewport()

使用于计算有效视区的 UIElement视区状态失效。

(继承自 FrameworkElement)
Measure(Size)

汇报 UIElementDesiredSize。 通常,为其布局子级实现自定义布局的对象从其自己的 MeasureOverride 实现中调用此方法,以形成递归布局更新。

(继承自 UIElement)
MeasureOverride(Size)

为布局周期的“度量”传递提供行为。 类可以重写此方法以定义其自己的“Measure”传递行为。

(继承自 FrameworkElement)
OnApplyTemplate()

每当应用程序代码或内部进程 (例如重新生成布局传递) 调用 ApplyTemplate 时调用。 简单来说,这意味着在 UI 元素在应用中显示之前调用 方法。 重写此方法以影响类的默认模板后逻辑。

(继承自 FrameworkElement)
OnBringIntoViewRequested(BringIntoViewRequestedEventArgs)

BringIntoViewRequested 事件发生之前调用。

(继承自 UIElement)
OnCharacterReceived(CharacterReceivedRoutedEventArgs)

CharacterReceived 事件发生之前调用。

(继承自 Control)
OnContentChanged(Object, Object)

Content 属性的值更改时调用。

(继承自 ContentControl)
OnContentTemplateChanged(DataTemplate, DataTemplate)

ContentTemplate 属性的值更改时调用。

(继承自 ContentControl)
OnContentTemplateSelectorChanged(DataTemplateSelector, DataTemplateSelector)

ContentTemplateSelector 属性的值更改时调用。

(继承自 ContentControl)
OnCreateAutomationPeer()

在派生类中实现时,为 Microsoft UI 自动化基础结构返回特定于类的 AutomationPeer 实现。

(继承自 UIElement)
OnDisconnectVisualChildren()

重写此方法以实现从类特定内容或子属性中删除项时布局和逻辑的行为方式。

(继承自 UIElement)
OnDoubleTapped(DoubleTappedRoutedEventArgs)

DoubleTapped 事件发生之前调用。

(继承自 Control)
OnDragEnter(DragEventArgs)

DragEnter 事件发生之前调用。

(继承自 Control)
OnDragLeave(DragEventArgs)

DragLeave 事件发生之前调用。

(继承自 Control)
OnDragOver(DragEventArgs)

DragOver 事件发生之前调用。

(继承自 Control)
OnDrop(DragEventArgs)

Drop 事件发生之前调用。

(继承自 Control)
OnGotFocus(RoutedEventArgs)

GotFocus 事件发生之前调用。

(继承自 Control)
OnHolding(HoldingRoutedEventArgs)

“保留 ”事件发生之前调用。

(继承自 Control)
OnKeyboardAcceleratorInvoked(KeyboardAcceleratorInvokedEventArgs)

在应用中处理 键盘快捷方式 (或快捷键) 时调用。 重写此方法以处理调用键盘快捷键时应用响应的方式。

(继承自 UIElement)
OnKeyDown(KeyRoutedEventArgs)

KeyDown 事件发生之前调用。

(继承自 Control)
OnKeyUp(KeyRoutedEventArgs)

KeyUp 事件发生之前调用。

(继承自 Control)
OnLostFocus(RoutedEventArgs)

LostFocus 事件发生之前调用。

(继承自 Control)
OnManipulationCompleted(ManipulationCompletedRoutedEventArgs)

ManipulationCompleted 事件发生之前调用。

(继承自 Control)
OnManipulationDelta(ManipulationDeltaRoutedEventArgs)

ManipulationDelta 事件发生之前调用。

(继承自 Control)
OnManipulationInertiaStarting(ManipulationInertiaStartingRoutedEventArgs)

ManipulationInertiaStarting 事件发生之前调用。

(继承自 Control)
OnManipulationStarted(ManipulationStartedRoutedEventArgs)

ManipulationStarted 事件发生之前调用。

(继承自 Control)
OnManipulationStarting(ManipulationStartingRoutedEventArgs)

ManipulationStarting 事件发生之前调用。

(继承自 Control)
OnPointerCanceled(PointerRoutedEventArgs)

PointerCanceled 事件发生之前调用。

(继承自 Control)
OnPointerCaptureLost(PointerRoutedEventArgs)

PointerCaptureLost 事件发生之前调用。

(继承自 Control)
OnPointerEntered(PointerRoutedEventArgs)

PointerEntered 事件发生之前调用。

(继承自 Control)
OnPointerExited(PointerRoutedEventArgs)

PointerExited 事件发生之前调用。

(继承自 Control)
OnPointerMoved(PointerRoutedEventArgs)

PointerMoved 事件发生之前调用。

(继承自 Control)
OnPointerPressed(PointerRoutedEventArgs)

PointerPressed 事件发生之前调用。

(继承自 Control)
OnPointerReleased(PointerRoutedEventArgs)

PointerReleased 事件发生之前调用。

(继承自 Control)
OnPointerWheelChanged(PointerRoutedEventArgs)

PointerWheelChanged 事件发生之前调用。

(继承自 Control)
OnPreviewKeyDown(KeyRoutedEventArgs)

PreviewKeyDown 事件发生之前调用。

(继承自 Control)
OnPreviewKeyUp(KeyRoutedEventArgs)

PreviewKeyUp 事件发生之前调用。

(继承自 Control)
OnProcessKeyboardAccelerators(ProcessKeyboardAcceleratorEventArgs)

在应用中处理 键盘快捷方式 (或快捷键) 之前调用。 每当应用程序代码或内部进程调用 ProcessKeyboardAccelerators 时调用。 重写此方法以影响默认加速器处理。

(继承自 UIElement)
OnRightTapped(RightTappedRoutedEventArgs)

RightTapped 事件发生之前调用。

(继承自 Control)
OnTapped(TappedRoutedEventArgs)

点击 事件发生之前调用。

(继承自 Control)
PopulatePropertyInfo(String, AnimationPropertyInfo)

定义可进行动画处理的属性。

(继承自 UIElement)
PopulatePropertyInfoOverride(String, AnimationPropertyInfo)

在派生类中重写时,定义可进行动画处理的属性。

(继承自 UIElement)
ReadLocalValue(DependencyProperty)

如果设置了本地值,则返回依赖属性的本地值。

(继承自 DependencyObject)
RegisterAnchorCandidate(UIElement)

UIElement 注册为潜在的滚动定位点。

RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)

注册通知函数,用于侦听此 DependencyObject 实例上对特定 DependencyProperty 的更改。

(继承自 DependencyObject)
ReleasePointerCapture(Pointer)

释放指针捕获,以便通过此 UIElement 捕获一个特定指针。

(继承自 UIElement)
ReleasePointerCaptures()

释放此元素持有的所有指针捕获。

(继承自 UIElement)
RemoveFocusEngagement()

为游戏板/远程交互) 具有焦点参与 (的控件释放控件边界的焦点。

(继承自 Control)
RemoveHandler(RoutedEvent, Object)

从此 UIElement 中删除指定的路由事件处理程序。 通常,有问题的处理程序是由 AddHandler 添加的。

(继承自 UIElement)
ScrollToHorizontalOffset(Double)

注意

scrollToHorizontalOffset 在Windows 8.1后可能会更改或不可用于发布。 请改用 ChangeView

ScrollViewer 中的内容滚动到指定的水平偏移位置。

ScrollToVerticalOffset(Double)

注意

scrollToVerticalOffset 可能会在Windows 8.1后更改或不可用。 请改用 ChangeView

ScrollViewer 中的内容滚动到指定的垂直偏移位置。

SetBinding(DependencyProperty, BindingBase)

使用提供的绑定对象将绑定附加到 FrameworkElement

(继承自 FrameworkElement)
SetBringIntoViewOnFocusChange(DependencyObject, Boolean)

设置指定元素上 BringIntoViewOnFocusChange 依赖属性/ ScrollViewer.BringIntoViewOnFocusChange XAML 附加属性的值。

SetCanContentRenderOutsideBounds(DependencyObject, Boolean)

设置指定元素上的 CanContentRenderOutsideBounds 依赖属性/ ScrollViewer.CanContentRenderOutsideBounds XAML 附加属性的值。

SetHorizontalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

设置指定元素上的 HorizontalScrollBarVisibility 依赖属性/ ScrollViewer.HorizontalScrollBarVisibility XAML 附加属性的值。

SetHorizontalScrollMode(DependencyObject, ScrollMode)

设置指定元素上的 HorizontalScrollMode 依赖属性/ ScrollViewer.HorizontalScrollMode XAML 附加属性的值。

SetIsDeferredScrollingEnabled(DependencyObject, Boolean)

设置指定元素上的 IsDeferredScrollingEnabled 依赖属性/ ScrollViewer.IsDeferredScrollingEnabled XAML 附加属性的值。

SetIsHorizontalRailEnabled(DependencyObject, Boolean)

设置指定元素上的 IsHorizontalRailEnabled 依赖属性/ ScrollViewer.IsHorizontalRailEnabled XAML 附加属性的值。

SetIsHorizontalScrollChainingEnabled(DependencyObject, Boolean)

设置指定元素上的 IsHorizontalScrollChainingEnabled 依赖属性/ ScrollViewer.IsHorizontalScrollChainingEnabled XAML 附加属性的值。

SetIsScrollInertiaEnabled(DependencyObject, Boolean)

设置指定元素上的 IsScrollInertiaEnabled 依赖属性/ ScrollViewer.IsScrollInertiaEnabled XAML 附加属性的值。

SetIsVerticalRailEnabled(DependencyObject, Boolean)

设置指定元素上的 IsVerticalRailEnabled 依赖属性/ ScrollViewer.IsVerticalRailEnabled XAML 附加属性的值。

SetIsVerticalScrollChainingEnabled(DependencyObject, Boolean)

设置指定元素上的 IsVerticalScrollChainingEnabled 依赖属性/ ScrollViewer.IsVerticalScrollChainingEnabled XAML 附加属性的值。

SetIsZoomChainingEnabled(DependencyObject, Boolean)

设置指定元素上的 IsZoomChainingEnabled 依赖属性/ ScrollViewer.IsZoomChainingEnabled XAML 附加属性的值。

SetIsZoomInertiaEnabled(DependencyObject, Boolean)

设置指定元素上的 IsZoomInertiaEnabled 依赖属性/ ScrollViewer.IsZoomInertiaEnabled XAML 附加属性的值。

SetValue(DependencyProperty, Object)

设置 DependencyObject 上依赖属性的本地值。

(继承自 DependencyObject)
SetVerticalScrollBarVisibility(DependencyObject, ScrollBarVisibility)

设置指定元素上的 VerticalScrollBarVisibility 依赖属性/ ScrollViewer.VerticalScrollBarVisibility XAML 附加属性的值。

SetVerticalScrollMode(DependencyObject, ScrollMode)

设置指定元素上的 VerticalScrollMode 依赖属性/ ScrollViewer.VerticalScrollMode XAML 附加属性的值。

SetZoomMode(DependencyObject, ZoomMode)

设置指定元素上的 ZoomMode 依赖属性/ ScrollViewer.ZoomMode XAML 附加属性的值。

StartAnimation(ICompositionAnimationBase)

开始元素上的指定动画。

(继承自 UIElement)
StartBringIntoView()

向 XAML 框架发起请求,以将元素引入其包含的任何可滚动区域内的视图。

(继承自 UIElement)
StartBringIntoView(BringIntoViewOptions)

启动对 XAML 框架的请求,以使用指定的选项将元素引入视图。

(继承自 UIElement)
StartDragAsync(PointerPoint)

启动拖放操作。

(继承自 UIElement)
StopAnimation(ICompositionAnimationBase)

停止元素上的指定动画。

(继承自 UIElement)
TransformToVisual(UIElement)

返回一个转换对象,该对象可用于将 坐标从 UIElement 转换为指定对象。

(继承自 UIElement)
TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)

尝试通过搜索 UIElement 的整个可视化树来 (或快捷键) 调用键盘快捷方式。

(继承自 UIElement)
UnregisterAnchorCandidate(UIElement)

UIElement 注销为潜在的滚动定位点。

UnregisterPropertyChangedCallback(DependencyProperty, Int64)

取消以前通过调用 RegisterPropertyChangedCallback 注册的更改通知。

(继承自 DependencyObject)
UpdateLayout()

确保针对布局正确更新 UIElement 的子对象的所有位置。

(继承自 UIElement)
ZoomToFactor(Single)

注意

Windows 8.1后,ZoomToFactor 可能会更改或不可用。 请改用 ChangeView

设置 ZoomFactor 的有效值。

事件

AccessKeyDisplayDismissed

在不应再显示访问密钥时发生。

(继承自 UIElement)
AccessKeyDisplayRequested

当用户请求显示访问密钥时发生。

(继承自 UIElement)
AccessKeyInvoked

当用户完成访问密钥序列时发生。

(继承自 UIElement)
ActualThemeChanged

在 ActualTheme 属性值更改时发生。

(继承自 FrameworkElement)
AnchorRequested

在排列传递的开头请求定位点时发生。 处理此事件以替代 ScrollViewer 的默认逻辑,以选择定位点元素作为 滚动定位的一部分。

BringIntoViewRequested

在此元素或其后代之一上调用 StartBringIntoView 时发生。

(继承自 UIElement)
CharacterReceived

输入队列接收到单个组合字符时发生。

(继承自 UIElement)
ContextCanceled

当上下文输入手势继续转换为操作手势时发生,以通知元素不应打开上下文浮出控件。

(继承自 UIElement)
ContextRequested

当用户完成上下文输入手势(例如右键单击)时发生。

(继承自 UIElement)
DataContextChanged

FrameworkElement.DataContext 属性的值更改时发生。

(继承自 FrameworkElement)
DirectManipulationCompleted

ScrollViewer 的任何直接操作完成时发生。

DirectManipulationStarted

ScrollViewer 的任何直接操作开始时发生。

DoubleTapped

当此元素的命中测试区域发生其他未经处理的 DoubleTap 交互时发生。

(继承自 UIElement)
DragEnter

当输入系统报告具有此元素作为目标的基础拖动事件时发生。

(继承自 UIElement)
DragLeave

当输入系统报告具有此元素作为原点的基础拖动事件时发生。

(继承自 UIElement)
DragOver

在输入系统报告出现以此元素为可能放置目标的基础拖动事件时发生。

(继承自 UIElement)
DragStarting

在启动拖动操作时发生。

(继承自 UIElement)
Drop

在输入系统报告出现将此元素作为放置目标的基础放置事件时发生。

(继承自 UIElement)
DropCompleted

结束此元素作为源的拖放操作时发生。

(继承自 UIElement)
EffectiveViewportChanged

FrameworkElement的有效视区 更改时发生。

(继承自 FrameworkElement)
FocusDisengaged

当焦点从游戏板/远程交互) 的控制边界 (释放时发生。

(继承自 Control)
FocusEngaged

当焦点限制在游戏板/远程交互) 的控制边界 (时发生。

(继承自 Control)
GettingFocus

UIElement 接收焦点之前发生。 此事件是同步引发的,以确保在事件冒泡时不会移动焦点。

(继承自 UIElement)
GotFocus

UIElement 收到焦点时发生。 此事件是异步引发的,因此焦点可以在浮升完成之前再次移动。

(继承自 UIElement)
Holding

当此元素的命中测试区域发生其他未处理的 保持 交互时发生。

(继承自 UIElement)
IsEnabledChanged

IsEnabled 属性更改时发生。

(继承自 Control)
KeyDown

UIElement 具有焦点时按下键盘键时发生。

(继承自 UIElement)
KeyUp

UIElement 具有焦点时释放键盘键时发生。

(继承自 UIElement)
LayoutUpdated

当可视化树的布局更改时发生,因为布局相关的属性更改值或刷新布局的其他操作。

(继承自 FrameworkElement)
Loaded

在已构造 FrameworkElement 并将其添加到对象树中并准备好交互时发生。

(继承自 FrameworkElement)
Loading

在开始加载 FrameworkElement 时发生。

(继承自 FrameworkElement)
LosingFocus

UIElement 失去焦点之前发生。 此事件是同步引发的,以确保在事件冒泡时不会移动焦点。

(继承自 UIElement)
LostFocus

UIElement 失去焦点时发生。 此事件是异步引发的,因此焦点可以在浮升完成之前再次移动。

(继承自 UIElement)
ManipulationCompleted

UIElement 上的操作完成时发生。

(继承自 UIElement)
ManipulationDelta

当输入设备在操作期间更改位置时发生。

(继承自 UIElement)
ManipulationInertiaStarting

在输入设备在操作期间与 UIElement 对象失去联系和延迟开始时发生。

(继承自 UIElement)
ManipulationStarted

在输入设备在 UIElement 上开始操作时发生。

(继承自 UIElement)
ManipulationStarting

在首次创建操作处理器时发生。

(继承自 UIElement)
NoFocusCandidateFound

当用户尝试通过选项卡或方向箭头 (移动焦点时发生) ,但焦点无法移动,因为没有在移动方向上找到焦点候选项。

(继承自 UIElement)
PointerCanceled

当进行接触的指针异常失去接触时发生。

(继承自 UIElement)
PointerCaptureLost

当指针捕获以前由此元素移动到另一个元素或其他位置时发生。

(继承自 UIElement)
PointerEntered

当指针进入此元素的命中测试区域时发生。

(继承自 UIElement)
PointerExited

当指针离开此元素的命中测试区域时发生。

(继承自 UIElement)
PointerMoved

当指针在指针停留在此元素的命中测试区域内时移动时发生。

(继承自 UIElement)
PointerPressed

当指针设备在此元素中启动 Press 操作时发生。

(继承自 UIElement)
PointerReleased

在释放之前启动 按下 操作的指针设备时发生,同时在此元素中。 请注意, 不保证按下 操作的结尾会触发 PointerReleased 事件;可能会触发其他事件。 有关详细信息,请参阅备注。

(继承自 UIElement)
PointerWheelChanged

在指针滚轮的增量值更改时发生。

(继承自 UIElement)
PreviewKeyDown

UIElement 具有焦点时按下键盘键时发生。

(继承自 UIElement)
PreviewKeyUp

UIElement 具有焦点时释放键盘键时发生。

(继承自 UIElement)
ProcessKeyboardAccelerators

按下 键盘快捷方式 (或快捷键) 时发生。

(继承自 UIElement)
RightTapped

当指针位于 元素上时发生右点击输入刺激时发生。

(继承自 UIElement)
SizeChanged

ActualHeightActualWidth 属性更改 FrameworkElement 上的值时发生。

(继承自 FrameworkElement)
Tapped

在此元素的命中测试区域上发生未经处理的 点击 交互时发生。

(继承自 UIElement)
Unloaded

当此对象不再连接到main对象树时发生。

(继承自 FrameworkElement)
ViewChanged

当滚动和缩放等操作导致视图更改时发生。

ViewChanging

滚动和缩放等操作导致视图更改时发生。

适用于

另请参阅