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

定義

この要素の描画時の高さを取得します。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

プロパティ値

要素の高さ (デバイスに依存しない単位 (1 単位は 1/96 インチ)device-independent units (1/96th inch per unit) の値)。The element's height, as a value in デバイスに依存しない単位 (1 単位は 1/96 インチ)device-independent units (1/96th inch per unit). 既定値は 0 (ゼロ) です。The default value is 0 (zero).

次の例では、さまざまな高さのプロパティを表示します。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

注釈

このプロパティは、他の高さ入力に基づいて計算された値であり、レイアウトシステムです。This property is a calculated value based on other height inputs, and the layout system. 値は、実際のレンダリングパスに基づいてレイアウトシステム自体によって設定されます。したがって、入力の変更の基礎とHeightなるなどのプロパティの設定値よりも少し遅れが生じることがあります。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.

ActualHeight計算値であるため、レイアウトシステムによるさまざまな操作の結果として、複数のまたは増分の報告される変更がある可能性があることに注意してください。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.

このプロパティをからXAMLXAML設定することはできませんが、スタイルの値に基づいてをTrigger作成することはできます。Although you cannot set this property from XAMLXAML, you can base a Trigger upon its value in a style.

依存プロパティ情報Dependency Property Information

識別子フィールドIdentifier field ActualHeightProperty
メタデータプロパティがに設定されるtrueMetadata properties set to true NoneNone

適用対象