FrameworkElement.MaxHeight 屬性

定義

取得或設定元素的最大高度限制。Gets or sets the maximum height constraint of the element.

public:
 property double MaxHeight { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public double MaxHeight { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)>]
member this.MaxHeight : double with get, set
Public Property MaxHeight As Double

屬性值

Double

項目的最大高度 (以 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit) 為單位)。The maximum height of the element, in 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit). 預設值是 PositiveInfinityThe default value is PositiveInfinity. 這個值可以是等於或大於 0.0 的任何值。This value can be any value equal to or greater than 0.0. PositiveInfinity 也有效。PositiveInfinity is also valid.

屬性

備註

這是中的三個屬性之一 FrameworkElement ,指定高度資訊。This is one of three properties on FrameworkElement that specify height information. 另外兩個是 MinHeightHeightThe other two are MinHeight and Height. 如果這些值之間發生衝突,則必須先接受實際高度判斷的應用程式順序, MinHeight MaxHeight 最後,如果每一個都在界限內,則為最後一個 HeightIf there is a conflict between these values, the order of application for actual height determination is first MinHeight must be honored, then MaxHeight, and finally if each of these are within bounds, Height.

值的值限制 Double 是由機制強制執行 ValidateValueCallbackThe value restrictions on the Double value are enforced by a ValidateValueCallback mechanism. 如果您嘗試設定的值無效,則會擲回執行時間例外狀況。If you attempt to set an invalid value a run-time exception is thrown.

XAML Attribute UsageXAML Attribute Usage

<object MaxHeight="double"/>  

-或--or-

<object MaxHeight ="qualifiedDouble"/>  

XAML 值XAML Values

doubledouble
Double

值的字串表示, Double 等於或大於0.0。String representation of a Double value equal to or greater than 0.0. 這會被視為 裝置獨立單位 (1/96 英吋)device-independent unit (1/96th inch) 度量。This is interpreted as a 裝置獨立單位 (1/96 英吋)device-independent unit (1/96th inch) measurement. 字串不需要明確包含小數點。Strings need not explicitly include decimal points. 比方說,的值 1 是可接受的。For instance a value of 1 is acceptable.

Double除了屬性值區段中所述的相同範圍限制之外,不同之處在于您必須明確將值設定為時,才需要使用X:Static 標記延伸 PositiveInfinityThe same Double range restrictions as mentioned in the Property Value section apply, except that you must use x:Static Markup Extension if you need to explicitly set the value to be PositiveInfinity.

qualifiedDoublequalifiedDouble
如上所述的 雙精度 值,後面接著下列其中一個單元宣告字串: pxincmptA double value as described above, followed by one of the following unit declaration strings: px, in, cm, pt.

px (預設) 為 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)px (default) is 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)

in 為英寸;1in = = 96pxin is inches; 1in==96px

cm 是公分;1cm = = (96/2.54) pxcm is centimeters; 1cm==(96/2.54) px

pt 是點;1pt = = (96/72) pxpt is points; 1pt==(96/72) px

相依性屬性資訊Dependency Property Information

識別碼欄位Identifier field MaxHeightProperty
中繼資料屬性設定為 trueMetadata properties set to true AffectsMeasure

適用於