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


取得或設定元素的最小寬度限制。Gets or sets the minimum width constraint of the element.

 property double MinWidth { double get(); void set(double value); };
[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. 不過,PositiveInfinityNaN 則無效。However, PositiveInfinity is not valid, nor is NaN.


這是指定寬度資訊的三FrameworkElement個屬性之一。This is one of three properties on FrameworkElement that specify width information. 其他兩個則WidthMaxWidth和。The 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 Attribute UsageXAML Attribute Usage

<object MinWidth="double"/>  


<object MinWidth="qualifiedDouble"/>  



等於或大於 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.

如上所述的 double值, 後面接著下列其中一個單元宣告字串: 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 MinWidthProperty
中繼資料屬性設定為trueMetadata properties set to true AffectsMeasure