FrameworkElement.FlowDirection Property


获取或设置方向,文本和其他 用户界面 (UI)user interface (UI) 元素在任何控制其布局的父元素中都按此方向流动。Gets or sets the direction that text and other 用户界面 (UI)user interface (UI) elements flow within any parent element that controls their layout.

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

Property Value


文本和其他 UIUI 元素在它们的父元素中的流动方向,是一个枚举值。The direction that text and other UIUI elements flow within their parent element, as a value of the enumeration. 默认值是 LeftToRightThe default value is LeftToRight.



依赖属性用法设置此元素上的 FlowDirectionThe dependency property usage sets the FlowDirection on this element. 由于属性值继承,因此在元素上设置 FlowDirection 可能会在未 FlowDirection 本地或其他方式(如样式)上设置 FlowDirectionBecause of property value inheritance, setting FlowDirection on an element can potentially set FlowDirection on all child elements that did not set FlowDirection locally or though other means such as styles.

此属性不会自动设置为任何应用程序区域性信息的一部分,因为元素可能包含不一定要遵循区域性信息隐含的一般流方向的内容。This property is not automatically set as part of any application culture information, because an element might contain content that is not necessarily intended to obey the general flow direction implied by the culture information. 有关全球化注意事项的详细信息,请参阅WPF 的全球化For more information on globalization considerations, see Globalization for WPF.

此属性具有定义的 公共语言运行时 (CLR)common language runtime (CLR) 属性访问器,因此它将作为依赖属性。This property has a defined 公共语言运行时 (CLR)common language runtime (CLR) property accessor, so it functions as a dependency property. 不过,它也注册为附加属性,因此它也可以作为附加属性。However, it is also registered as attached, so it can also function as an attached property. 附加的注册主要是为了支持属性值继承,但属性也可用作真正的附加属性。The attached registration is mainly so that property value inheritance is supported, but the property can also be used as a true attached property. 仅当要设置流方向的对象具有执行布局的 FrameworkElement 父元素时,附加属性用法才适用,它本身不是 FrameworkElement,并且还没有更直接定义 FlowDirection 属性。The attached property usage is only relevant if the object you intend to set the flow direction on has a FrameworkElement parent element that performs layout upon it, is itself not a FrameworkElement, and does not already have a more directly defined FlowDirection property. (某些流文档类(如 BlockInline 定义它们自己的 FlowDirection,并且此属性还可以设置流方向。(Some of the flow document classes such as Block and Inline define their own FlowDirection, and this property can also set the flow direction. 然后,最终内容主机会读取属性值,而无需附加的属性用法。)The property value is then read by the eventual content host without requiring attached property usage.)

XAML 特性用法XAML Attribute Usage

<对象 **>**= "FlowDirection"/><object FlowDirection="FlowDirection"/>

XAML 文本用法XAML Text Usage

还可以通过以下 XAMLXAML 附加属性用法,在不 FrameworkElement 派生类的类上设置此属性:This property can also be set on classes that are not FrameworkElement derived classes, by the following XAMLXAML attached property usage:

<对象>= "FlowDirection"/>< object FrameworkElement.FlowDirection="FlowDirection"/>

依赖项属性信息Dependency Property Information

标识符字段Identifier field FlowDirectionProperty
元数据属性设置为 trueMetadata properties set to true AffectsMeasureAffectsParentArrangeInheritsAffectsMeasure, AffectsParentArrange, Inherits

此属性既是依赖属性,也是附加属性;请参阅 "备注"。This property is both a dependency property and an attached property; see Remarks.

Applies to