FrameworkElement.ActualHeight FrameworkElement.ActualHeight FrameworkElement.ActualHeight FrameworkElement.ActualHeight Property

Définition

Obtient la hauteur rendue de cet élément.Gets the rendered height of this element.

public:
 property double ActualHeight { double get(); };
public double ActualHeight { get; }
member this.ActualHeight : double
Public ReadOnly Property ActualHeight As Double

Valeur de propriété

Hauteur de l'élément, exprimée en unités indépendantes des appareils (1/96e de pouce par unité)device-independent units (1/96th inch per unit).The element's height, as a value in unités indépendantes des appareils (1/96e de pouce par unité)device-independent units (1/96th inch per unit). La valeur par défaut est 0 (zéro).The default value is 0 (zero).

Exemples

L’exemple suivant affiche diverses propriétés de hauteur.The following example displays various height properties.

private void changeHeight(object sender, SelectionChangedEventArgs args)
{
    ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);
    Double sz1 = Double.Parse(li.Content.ToString());
    rect1.Height = sz1;
    rect1.UpdateLayout();
    txt1.Text= "ActualHeight is set to " + rect1.ActualHeight;
    txt2.Text= "Height is set to " + rect1.Height;
    txt3.Text= "MinHeight is set to " + rect1.MinHeight;
    txt4.Text= "MaxHeight is set to " + rect1.MaxHeight;
}
private void changeMinHeight(object sender, SelectionChangedEventArgs args)
{
    ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);
    Double sz1 = Double.Parse(li.Content.ToString());
    rect1.MinHeight = sz1;
    rect1.UpdateLayout();
    txt1.Text= "ActualHeight is set to " + rect1.ActualHeight;
    txt2.Text= "Height is set to " + rect1.Height;
    txt3.Text= "MinHeight is set to " + rect1.MinHeight;
    txt4.Text= "MaxHeight is set to " + rect1.MaxHeight;
}
private void changeMaxHeight(object sender, SelectionChangedEventArgs args)
{
    ListBoxItem li = ((sender as ListBox).SelectedItem as ListBoxItem);
    Double sz1 = Double.Parse(li.Content.ToString());
    rect1.MaxHeight = sz1;
    rect1.UpdateLayout();
    txt1.Text= "ActualHeight is set to " + rect1.ActualHeight;
    txt2.Text= "Height is set to " + rect1.Height;
    txt3.Text= "MinHeight is set to " + rect1.MinHeight;
    txt4.Text= "MaxHeight is set to " + rect1.MaxHeight;
}
Private 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
Private 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
Private 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

Remarques

Cette propriété est une valeur calculée en fonction d’autres entrées de hauteur et du système de disposition.This property is a calculated value based on other height inputs, and the layout system. La valeur est définie par le système de disposition lui-même, en fonction d’une passe de rendu réelle, et peut par conséquent être légèrement en retard Height par rapport à la valeur définie des propriétés, telles que la base de la modification d’entrée.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.

Étant ActualHeight donné que est une valeur calculée, vous devez savoir qu’il peut y avoir des modifications multiples ou incrémentielles signalées à celle-ci suite à différentes opérations par le système de disposition.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. Celui-ci peut en effet calculer l’espace de mesure requis pour les éléments enfants, les contraintes de l’élément parent, et ainsi de suite.The layout system may be calculating required measure space for child elements, constraints by the parent element, and so on.

Bien que vous ne puissiez pas définir XAMLXAMLcette propriété à partir de Trigger , vous pouvez baser un en fonction de sa valeur dans un style.Although you cannot set this property from XAMLXAML, you can base a Trigger upon its value in a style.

Informations sur les propriétés de dépendanceDependency Property Information

Champ d’identificateurIdentifier field ActualHeightProperty
Propriétés de métadonnées définies surtrueMetadata properties set to true Aucun.None

S’applique à