FrameworkElement.VerticalAlignment 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置在父元素(如面板或项控件)内组合时应用于此元素的垂直对齐特征。
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
属性值
垂直对齐设置。 默认值为 Stretch。
注解
Height在元素上显式设置属性时Width,这些度量采用布局先例并取消将此属性设置为Stretch的常规效果。
VerticalAlignment是依赖项属性现实中的Microsoft .NET属性访问器。 此特定依赖属性非常频繁地在派生元素类中以不同的方式设置其明显的“默认值”值,尤其是控件。 这通常以以下两种方式之一发生:依赖属性重新注册到特定的派生类,但使用不同的元数据来设置其默认值:或者应用默认样式,该样式会以不同的方式设置依赖属性值。 例如,即使直接继承自控件,VerticalAlignment控件的ComboBoxItemCenter明显“默认值”也是ComboBoxItem。VerticalAlignmentFrameworkElement 这是因为该值是在样式控件模板的默认样式 ComboBoxItem内重置的。
Canvas 撰写布局时不使用 VerticalAlignment ,因为 Canvas 基于绝对定位。
当继承自ComboBoxItem或任何派生类时,ComboBoxItem请重新定义此属性的默认值。Center
Dependency 属性信息
| 项目 | 价值 |
|---|---|
| 标识符字段 | VerticalAlignmentProperty |
元数据属性设置为 true |
AffectsArrange |