RequestBringIntoViewEventHandler Delegate

Definition

表示将处理 RequestBringIntoView 路由事件的方法。Represents the method that will handle the RequestBringIntoView routed event.

public delegate void RequestBringIntoViewEventHandler(System::Object ^ sender, RequestBringIntoViewEventArgs ^ e);
public delegate void RequestBringIntoViewEventHandler(object sender, RequestBringIntoViewEventArgs e);
type RequestBringIntoViewEventHandler = delegate of obj * RequestBringIntoViewEventArgs -> unit
Public Delegate Sub RequestBringIntoViewEventHandler(sender As Object, e As RequestBringIntoViewEventArgs)

Parameters

sender
Object

事件处理程序附加到的对象。The object where the event handler is attached.

e
RequestBringIntoViewEventArgs

事件数据。The event data.

Inheritance
RequestBringIntoViewEventHandler

Remarks

处理此事件通常只在支持可滚动区域的元素内完成,或者有意将其呈现大小设置得小于其子元素内容的所需大小,只需在元素树中向上传递事件并已到达提供滚动区域支持的第一个父项后,即可特意处理事件。Handling this event is typically only done within elements that support a scrollable region, or otherwise deliberately set their rendering size smaller than the combined desired size of their child element content, and is only done by deliberately handling the event once it has routed upwards in the element tree and has reached the first parent that offers scrolling region support. 以用户控件通常需要的方式处理滚动区域的现有实现 ScrollViewerAn existing implementation that handles scrolling regions in a manner that is typically desirable for user controls is ScrollViewer. 如果从 ScrollViewer派生,则可以为 FrameworkElement.RequestBringIntoView 注册类处理程序,并补充事件的基类处理。If you derive from ScrollViewer, you can register a class handler for FrameworkElement.RequestBringIntoView and supplement the base class handling of the event. 还应考虑使用或类处理类定义的 ScrollChanged 事件,而不是 FrameworkElement.RequestBringIntoViewYou should also consider using or class-handling the class-defined ScrollChanged event instead of FrameworkElement.RequestBringIntoView. 或者,如果你创建了一个不是从 ScrollViewer派生的完全自定义类,则仍可以通过调用类实例化中的 EventManager.RegisterClassHandler 来添加类处理。Alternatively, if you create an entirely custom class that does not derive from ScrollViewer, you can still add class handling by calling EventManager.RegisterClassHandler in your class instantiation. 有关类处理的详细信息,请参阅将路由事件标记为 "已处理" 和 "类处理"。For details on class handling, see Marking Routed Events as Handled, and Class Handling.

内容元素可能会导致事件由其内容宿主引发(通过调用 BringIntoView 并从内容主机引发 FrameworkElement.RequestBringIntoView)。Content elements can cause the event to be raised by their content hosts (through calling BringIntoView and raising FrameworkElement.RequestBringIntoView from the content host). 同样,可以通过 LogicalTreeHelper.BringIntoView的帮助程序方法来请求使逻辑树元素进入视图。Similarly, you can request logical tree elements to be brought into view with the helper method LogicalTreeHelper.BringIntoView.

ListBox 实现了相关但不同方法 ScrollIntoViewA ListBox implements a related but different method ScrollIntoView.

Extension Methods

GetMethodInfo(Delegate)

获取指示指定委托表示的方法的对象。Gets an object that represents the method represented by the specified delegate.

Applies to

See also