FrameworkElement.SizeChanged 事件

定义

当此元素上的 ActualHeightActualWidth 属性的值发生更改时发生。Occurs when either the ActualHeight or the ActualWidth properties change value on this element.

public:
 event System::Windows::SizeChangedEventHandler ^ SizeChanged;
public event System.Windows.SizeChangedEventHandler SizeChanged;
member this.SizeChanged : System.Windows.SizeChangedEventHandler 
Public Custom Event SizeChanged As SizeChangedEventHandler 

注解

直接路由事件不遵循路由,它们只能在引发它们的同一元素内进行处理。Direct routed events do not follow a route, they are only handled within the same element on which they are raised. 直接路由事件支持其他路由事件行为:它们支持可访问的处理程序集合,并且可用作样式中的 EventTriggerDirect routed events do support other routed event behavior: they support an accessible handlers collection, and can be used as an EventTrigger in a style.

布局系统在此事件的 SizeChangedEventArgs 自变量类中读取属性,以确定是否应将所报告的大小更改视为重要更改。The layout system reads properties within the SizeChangedEventArgs argument class of this event, to determine whether the reported size changes should be considered significant. 这使得布局系统或特定于控件的布局实现可以避免由于新旧的高度或宽度值之间视觉让的差异而强制执行布局更改。This allows the layout system or your control-specific layout implementations to avoid forcing a layout change due to visually imperceptible differences between old and new height or width values. 让差异可能是由于浮点数据类型的舍入或相同结果计算造成的。The imperceptible differences might be due to rounding or same-result calculations of a floating-point data types.

路由事件信息Routed Event Information

标识符字段Identifier field SizeChangedEvent
路由策略Routing strategy 直接Direct
委托Delegate SizeChangedEventHandler

适用于

另请参阅