.NET Framework Class Library for Silverlight
FrameworkElement..::.LayoutUpdated Event

Occurs when the layout of the Silverlight visual tree changes.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)
Syntax

Visual Basic (Declaration)
Public Event LayoutUpdated As EventHandler
Visual Basic (Usage)
Dim instance As FrameworkElement
Dim handler As EventHandler

AddHandler instance.LayoutUpdated, handler
C#
public event EventHandler LayoutUpdated
XAML Attribute Usage
<frameworkElement LayoutUpdated="eventhandler"/>
Remarks

LayoutUpdated is the last object lifetime event to occur in the sequence prior to a control being ready for interaction. However, LayoutUpdated also can 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). LayoutUpdated fires after all possible SizeChanged events in the tree have fired.

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 in cases where 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, then 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 nullNothingnullptra null reference (Nothing in Visual Basic), 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.

Platforms

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

See Also

Reference

Other Resources

Tags :


Page view tracker