ProgressBar.Orientation 属性

定义

获取或设置 ProgressBar 的方向:水平或垂直。

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

属性值

Orientation

Orientation 值之一。 默认值为 Horizontal

示例

以下示例创建一个 ProgressBar 演示如何使用 Orientation 属性创建水平条。

ProgressBar progbar = new ProgressBar();
progbar.IsIndeterminate = false;
progbar.Orientation = Orientation.Horizontal;
progbar.Width = 150;
progbar.Height = 15;
Duration duration = new Duration(TimeSpan.FromSeconds(10));
DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
Dim progbar As New ProgressBar()
progbar.IsIndeterminate = False
progbar.Orientation = Orientation.Horizontal
progbar.Width = 150
progbar.Height = 15
Dim duration As New Duration(TimeSpan.FromSeconds(10))
Dim doubleanimation As New DoubleAnimation(100.0, duration)
progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation)

注解

依赖项属性信息

标识符字段 OrientationProperty
元数据属性设置为 true AffectsMeasure

适用于