ActualHeight property
Collapse the table of content
Expand the table of content

FrameworkElement.ActualHeight property

Gets the rendered height of a FrameworkElement. See Remarks.


public double ActualHeight { get; }

Property value

Type: System.Double [.NET] | float64 [C++]

The height, in pixels, of the object. The default is 0. The default might be encountered if the object has not been loaded and hasn't yet been involved in a layout pass that renders the UI.


Note  Although it has an ActualHeightProperty backing field, ActualHeight does not raise property change notifications and it should be thought of as a regular CLR property and not a dependency property.

ActualHeight is a calculated property. The calculations are a result of a layout pass, where the object is sized in layout according to the logic of its successive layout parents. For more info see Define layouts with XAML.

ActualHeight can have 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 Height, which can be the basis of the input change.

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


This example shows a common scenario where you use the ActualHeight of one or more elements in UI to set the Height of either one of the involved elements or a different element, so that the same net height is maintained after the action. This is usually done in response to event handlers that are invoked when elements are opened or closed, or the display area changes.

        void BottomAppBar_Opened(object sender, object e)
            // AppBar has Opened so we need to put the WebView back to its
            // original size/location.
            AppBar bottomAppBar = sender as AppBar;
            if (bottomAppBar != null)
                // Force layout so that we can guarantee that our AppBar's
                // actual height has height
                // Get the height of the AppBar
                double appBarHeight = bottomAppBar.ActualHeight;
                // Reduce the height of the WebView to allow for the AppBar
                WebView8.Height = WebView8.ActualHeight - appBarHeight;
                // Translate the WebView in the Y direction to reclaim the space occupied by 
                // the AppBar.  Notice that we translate it by appBarHeight / 2.0.
                // This is because the WebView has VerticalAlignment and HorizontalAlignment
                // of 'Stretch' and when we reduce its size it reduces its overall size
                // from top and bottom by half the amount.
                TranslateYOpen.To = -appBarHeight / 2.0;
                // Run our translate animation to match the AppBar

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::UI::Xaml [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]


Windows::UI::Xaml [C++]



See also




© 2017 Microsoft