Slider.TickPlacement 属性

定义

获取或设置与 TrackSlider 相关的刻度线的位置。

public:
 property System::Windows::Controls::Primitives::TickPlacement TickPlacement { System::Windows::Controls::Primitives::TickPlacement get(); void set(System::Windows::Controls::Primitives::TickPlacement value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.Controls.Primitives.TickPlacement TickPlacement { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.TickPlacement : System.Windows.Controls.Primitives.TickPlacement with get, set
Public Property TickPlacement As TickPlacement

属性值

TickPlacement

一个 TickPlacement 值,该值定义如何在与滑块条相关的 Slider 中放置刻度线。 默认值为 None

属性

示例

下面的示例演示如何设置 TickPlacement 属性。

Slider hslider = new Slider();
hslider.Width = 100;
hslider.Orientation = Orientation.Horizontal;
hslider.IsSnapToTickEnabled = true;
hslider.Minimum = 1;
hslider.Maximum = 20;
hslider.TickPlacement = TickPlacement.Both;
hslider.TickFrequency = 2;
hslider.AutoToolTipPlacement =
  AutoToolTipPlacement.BottomRight;
cv1.Children.Add(hslider);
Dim hslider As New Slider()
hslider.Width = 100
hslider.Orientation = Orientation.Horizontal
hslider.IsSnapToTickEnabled = True
hslider.Minimum = 1
hslider.Maximum = 20
hslider.TickPlacement = TickPlacement.Both
hslider.TickFrequency = 2
hslider.AutoToolTipPlacement = AutoToolTipPlacement.BottomRight
cv1.Children.Add(hslider)
<Slider Name="slider1" 
        Width="100" 
        Orientation="Horizontal" HorizontalAlignment="Left" 
        IsSnapToTickEnabled="True" Minimum="1" Maximum="20" 
        TickPlacement="Both"  TickFrequency="2"
        AutoToolTipPlacement="BottomRight"/>

注解

属性 TickPlacement 必须设置为非刻度线以外的 None 值才能显示。

适用于

另请参阅