Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FrameworkElement.ActualWidth Property

Gets the rendered width of a FrameworkElement.

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

public double ActualWidth { get; }

Property Value

Type: System.Double
The width, in pixels, of the object. The default is 0. The default might be encountered if the object has not been loaded and undergone a layout pass.

Be sure that you only rely on this property value when the passes that are involved in layout and in rendering for the relevant FrameworkElement are complete. ActualWidth is a calculated value, and there can be multiple or incremental reported changes to the value because of operations by the layout system. If you get the value while layout is still iterating, the layout system might still be calculating the required measure of space for child objects, constraints by the parent object, and so on. Because the value is based on an actual rendering pass, it may lag slightly behind the set value of properties like Width, which can be the basis of the input change.

The return value of ActualWidth might also reflect the influence of layout rounding. Certain containers (notably TextBlock) might return values that are not rounded, regardless of layout rounding settings. For more information, see Layout Rounding.

For purposes of ElementName binding, ActualWidth does not post updates when it changes (due to its asynchronous and run-time calculated nature). Do not attempt to use ActualWidth as a binding source for an ElementName binding. If you have a scenario that requires updates based on ActualWidth, use a SizeChanged handler.

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.

Community Additions

Show:
© 2014 Microsoft