FrameworkElement.ActualHeight Property
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
'Declaration Public ReadOnly Property ActualHeight As Double 'Usage Dim instance As FrameworkElement Dim value As Double value = instance.ActualHeight
/** @property */ public double get_ActualHeight ()
public function get ActualHeight () : double
You cannot use this property in XAML.
Property Value
The element's height, as a value in device-independent units (1/96th inch per unit). The default value is 0 (zero).This property is a calculated value based on other height inputs, and the layout system. The value is set by the layout system itself, based on an actual rendering pass, and may therefore lag slightly behind the set value of properties such as Height that are the basis of the input change.
Because ActualHeight is a calculated value, you should be aware that there could be multiple or incremental reported changes to it as a result of various operations by the layout system. The layout system may be calculating required measure space for child elements, constraints by the parent element, and so on.
Although you cannot set this property from XAML, you can base a Trigger upon its value in a style.
The following example displays various height properties.
Public Sub changeHeight(ByVal sender As Object, ByVal args As SelectionChangedEventArgs) Dim li As ListBoxItem = CType(CType(sender, ListBox).SelectedItem, ListBoxItem) Dim sz1 As Double = Double.Parse(li.Content.ToString()) rect1.Height = sz1 rect1.UpdateLayout() txt1.Text = "ActualHeight is set to " + rect1.ActualHeight.ToString txt2.Text = "Height is set to " + rect1.Height.ToString txt3.Text = "MinHeight is set to " + rect1.MinHeight.ToString txt4.Text = "MaxHeight is set to " + rect1.MaxHeight.ToString End Sub Public Sub changeMinHeight(ByVal sender As Object, ByVal args As SelectionChangedEventArgs) Dim li As ListBoxItem = CType(CType(sender, ListBox).SelectedItem, ListBoxItem) Dim sz1 As Double = Double.Parse(li.Content.ToString()) rect1.MinHeight = sz1 rect1.UpdateLayout() txt1.Text = "ActualHeight is set to " + rect1.ActualHeight.ToString txt2.Text = "Height is set to " + rect1.Height.ToString txt3.Text = "MinHeight is set to " + rect1.MinHeight.ToString txt4.Text = "MaxHeight is set to " + rect1.MaxHeight.ToString End Sub Public Sub changeMaxHeight(ByVal sender As Object, ByVal args As SelectionChangedEventArgs) Dim li As ListBoxItem = CType(CType(sender, ListBox).SelectedItem, ListBoxItem) Dim sz1 As Double = Double.Parse(li.Content.ToString()) rect1.MaxHeight = sz1 rect1.UpdateLayout() txt1.Text = "ActualHeight is set to " + rect1.ActualHeight.ToString txt2.Text = "Height is set to " + rect1.Height.ToString txt3.Text = "MinHeight is set to " + rect1.MinHeight.ToString txt4.Text = "MaxHeight is set to " + rect1.MaxHeight.ToString End Sub
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.