Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

FrameworkElement.LayoutUpdated Event

Silverlight

Occurs when the layout of the Silverlight visual tree changes.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
public event EventHandler LayoutUpdated
<frameworkElement LayoutUpdated="eventhandler"/>

LayoutUpdated is the last object lifetime event to occur in the sequence before a control is ready for interaction. However, LayoutUpdated can also occur at run time during the object lifetime, for a variety of reasons: a property change, a window resizing, or an explicit request (UpdateLayout or ApplyTemplate). The LayoutUpdated event is raised after all possible SizeChanged events in the tree have been raised.

In WPF, this event is a routed event, and is actually on UIElement not FrameworkElement. In Silverlight, this event is not a routed event; it is a standard CLR event that uses EventArgs, not RoutedEventArgs.

LayoutUpdated can occur when the object where the handler is attached does not necessarily change anything in the visual tree under it. For instance, imagine a layout container where there are two elements. If the first object changes a property that forces a new layout, both objects raise LayoutUpdated because the second object might be repositioned even if its own subsidiary layout does not change.

When you handle LayoutUpdated, do not rely on the sender value. For LayoutUpdated, sender is always null, regardless of where the handler is attached. This is to prevent handlers from assigning any meaning to sender, such as implying that it was that specific element that raised the event out of the visual tree. Rather, LayoutUpdated implies that something in the overall Silverlight visual tree has changed, and each specific object anywhere in the tree has the option of handling this occurrence. The Silverlight version of LayoutUpdated has this behavior in part to maintain WPF compatibility.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.