FrameworkElement.VerticalAlignment FrameworkElement.VerticalAlignment FrameworkElement.VerticalAlignment FrameworkElement.VerticalAlignment Property

定義

取得或設定套用至此項目在父項目 (例如面板或項目控制項) 中組成時的垂直對齊特性。Gets or sets the vertical alignment characteristics applied to this element when it is composed within a parent element such as a panel or items control.

public:
 property System::Windows::VerticalAlignment VerticalAlignment { System::Windows::VerticalAlignment get(); void set(System::Windows::VerticalAlignment value); };
public System.Windows.VerticalAlignment VerticalAlignment { get; set; }
member this.VerticalAlignment : System.Windows.VerticalAlignment with get, set
Public Property VerticalAlignment As VerticalAlignment

屬性值

垂直對齊設定。A vertical alignment setting. 預設為 StretchThe default is Stretch.

備註

HeightWidth項目上明確設定屬性,這些測量結果採取優先於版面配置] 和 [取消設定此屬性的規則的效果StretchWhen Height and Width properties are explicitly set on an element, these measurements take layout precedent and cancel the regular effects of setting this property to Stretch.

VerticalAlignmentMicrosoft .NETMicrosoft .NET屬性存取子是相依性屬性。VerticalAlignment is the Microsoft .NETMicrosoft .NET property accessor for what is in reality a dependency property. 這個特定的相依性屬性很頻繁已設定不同的衍生項目類別,特別是控制項在其明顯的 「 預設 」 值。This particular dependency property quite frequently has its apparent "default" value set differently in derived element classes, particularly controls. 這通常發生於兩種方式之一: 相依性屬性重新加以註冊特定的衍生類別中,但具有不同的中繼資料,設定其預設值;或以不同的方式設定該相依性屬性值的預設樣式套用。This generally occurs in one of two ways: the dependency property is re-registered to a particular derived class, but with different metadata for setting its defaults; or there is a default style being applied that sets that dependency property value differently. 比方說,明顯 「 預設 」 的VerticalAlignmentforComboBoxItem控制項將會是Center,即使ComboBoxItem繼承VerticalAlignment直接從FrameworkElementFor example, the apparent "default" of VerticalAlignment for a ComboBoxItem control will be Center, even though ComboBoxItem inherits VerticalAlignment direct from FrameworkElement. 這是因為該值重設的預設樣式內ComboBoxItem,樣式的控制項範本內。This is because that value was reset within the default style of ComboBoxItem, within the style's control template.

Canvas 不會使用VerticalAlignment當您在撰寫版面配置,因為Canvas根據絕對位置。Canvas does not use VerticalAlignment when composing layout, because Canvas is based on absolute positioning.

當繼承ComboBoxItem或任何衍生類別,ComboBoxItem重新定義預設值,這個屬性是CenterWhen inherited by ComboBoxItem or any derived classes, ComboBoxItem redefines the default value of this property to be Center.

相依性屬性資訊Dependency Property Information

識別項欄位Identifier field VerticalAlignmentProperty
若要設定的中繼資料屬性 trueMetadata properties set to true AffectsArrange

適用於