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; }
member this.MaxHeight : double with get, set
Public Property MaxHeight As 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. 如果这两个值之间存在冲突,则必须先使用应用程序的实际顺序确定,然后 MaxHeight,最后,如果其中每个 MinHeight 都在界限内,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 值的值限制由 ValidateValueCallback 机制强制执行。The 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 属性用法XAML Attribute Usage

<object MaxHeight="double"/>  

-or-

<object MaxHeight ="qualifiedDouble"/>  

XAML 值XAML Values

doubledouble
Double

大于或等于 0.0 Double 值的字符串表示形式。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 范围限制相同,不同之处在于,如果需要显式设置要 PositiveInfinity的值,则必须使用X:Static 标记扩展The 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
如上所述的双精度值,后跟以下单元声明字符串之一: pxincm``ptA 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

适用于