FrameworkElement.ActualHeight プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
この要素のレンダリングされた高さを取得します。
public:
property double ActualHeight { double get(); };
public double ActualHeight { get; }
member this.ActualHeight : double
Public ReadOnly Property ActualHeight As Double
プロパティ値
デバイスに依存しない単位 (単位あたり 1/96 インチ) の値としての要素の高さ。 既定値は 0 (ゼロ) です。
例
次の例では、さまざまな高さのプロパティを表示します。
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
注釈
このプロパティは、他の高さの入力とレイアウト システムに基づいて計算された値です。 この値は、実際のレンダリング パスに基づいてレイアウト システム自体によって設定されるため、入力変更の基礎となる Height などのプロパティの設定値よりもわずかに遅れる可能性があります。
ActualHeightは計算値であるため、レイアウト システムによるさまざまな操作の結果として、複数または増分の変更が報告される可能性があることに注意してください。 レイアウト システムでは、子要素の必要なメジャー領域、親要素による制約などを計算できます。
XAML からこのプロパティを設定することはできませんが、スタイル内の値に基づいて Trigger を設定できます。
依存関係プロパティ情報
| 品目 | 価値 |
|---|---|
| 識別子フィールド | ActualHeightProperty |
に設定されたメタデータ プロパティ true |
None |