FrameworkElement.MinWidth FrameworkElement.MinWidth FrameworkElement.MinWidth FrameworkElement.MinWidth Property

定义

获取或设置元素的最小宽度约束。Gets or sets the minimum width constraint of the element.

public:
 property double MinWidth { 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 MinWidth { get; set; }
member this.MinWidth : double with get, set
Public Property MinWidth As Double

属性值

元素的最小宽度,单位是 与设备无关的单位(每个单位 1/96 英寸)device-independent units (1/96th inch per unit)The minimum width of the element, in 与设备无关的单位(每个单位 1/96 英寸)device-independent units (1/96th inch per unit). 默认值为 0.0。The default value is 0.0. 该值可以是等于或大于 0.0 的任何值。This value can be any value equal to or greater than 0.0. 但是,PositiveInfinity 无效,NaN 也无效。However, PositiveInfinity is not valid, nor is NaN.

注解

这是指定宽度信息的三FrameworkElement个属性之一。This is one of three properties on FrameworkElement that specify width information. 另外两个是WidthMaxWidthThe other two are Width and MaxWidth. 如果这两个值之间存在冲突, 则首先MinWidth必须执行实际的宽度确定的应用程序顺序, 然后MaxWidth, 如果Width其中每个的值都在边界内, 则为。If there is a conflict between these values, the order of application for actual width determination is first MinWidth must be honored, then MaxWidth, and finally if each of these are within bounds, Width.

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 MinWidth="double"/>  

-or-

<object MinWidth="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值部分中提到的范围限制相同。The same Double range restrictions as mentioned in the Property Value section apply.

qualifiedDoublequalifiedDouble
如上所述的双精度值, 后跟以下单元声明字符串之一px:、 incmptA 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 MinWidthProperty
元数据属性设置为trueMetadata properties set to true AffectsMeasure

适用于