Slider.SelectionEnd 属性

定义

获取或设置 Slider 的指定选择内容的最大值。Gets or sets the largest value of a specified selection for a Slider.

public:
 property double SelectionEnd { double get(); void set(double value); };
[System.ComponentModel.Bindable(true)]
public double SelectionEnd { get; set; }
member this.SelectionEnd : double with get, set
Public Property SelectionEnd As Double

属性值

Slider 的值的选择范围的最大值。The largest value of a selected range of values of a Slider. 默认值为零 (0)。The default is zero (0.0).

属性

示例

下面的示例演示如何设置 SelectionEnd 属性。The following example shows how to set the SelectionEnd property.

Slider hslider = new Slider();
hslider.Orientation = Orientation.Horizontal;
hslider.Width = 100;
hslider.Minimum = 1;
hslider.Maximum = 10;
hslider.IsDirectionReversed = true;
hslider.IsMoveToPointEnabled = true;
hslider.AutoToolTipPrecision = 2;
hslider.AutoToolTipPlacement =
  AutoToolTipPlacement.BottomRight;
hslider.TickPlacement = TickPlacement.BottomRight;

// Manually add ticks to the slider.
DoubleCollection tickMarks = new DoubleCollection();
tickMarks.Add(0.5);
tickMarks.Add(1.5);
tickMarks.Add(2.5);
tickMarks.Add(3.5);
tickMarks.Add(4.5);
tickMarks.Add(5.5);
tickMarks.Add(6.5);
tickMarks.Add(7.5);
tickMarks.Add(8.5);
tickMarks.Add(9.5);
hslider.Ticks = tickMarks;

// Create a selection range.
hslider.IsSelectionRangeEnabled = true;
hslider.SelectionStart = 2.5;
hslider.SelectionEnd = 7.5;
cv2.Children.Add(hslider);
Dim hslider As New Slider()
hslider.Orientation = Orientation.Horizontal
hslider.Width = 100
hslider.Minimum = 1
hslider.Maximum = 10
hslider.IsDirectionReversed = True
hslider.IsMoveToPointEnabled = True
hslider.AutoToolTipPrecision = 2
hslider.AutoToolTipPlacement = AutoToolTipPlacement.BottomRight
hslider.TickPlacement = TickPlacement.BottomRight
Dim tickMarks As New DoubleCollection()
tickMarks.Add(0.5)
tickMarks.Add(1.5)
tickMarks.Add(2.5)
tickMarks.Add(3.5)
tickMarks.Add(4.5)
tickMarks.Add(5.5)
tickMarks.Add(6.5)
tickMarks.Add(7.5)
tickMarks.Add(8.5)
tickMarks.Add(9.5)
hslider.Ticks = tickMarks
hslider.IsSelectionRangeEnabled = True
hslider.SelectionStart = 2.5
hslider.SelectionEnd = 7.5
cv2.Children.Add(hslider)
<Slider Width="100" 
        Orientation="Horizontal"  
        Minimum="1" Maximum="10" 
        IsDirectionReversed="True"
        IsMoveToPointEnabled="True"
        AutoToolTipPrecision="2" AutoToolTipPlacement="BottomRight"
        TickPlacement="BottomRight"
        Ticks="0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5" 
        IsSelectionRangeEnabled="true"
        SelectionStart="2.5" SelectionEnd="7.5" Name="mySlider"/>

注解

SelectionEnd 属性的值不能大于 Maximum 属性的值,并且不能小于 Minimum 属性的值。The value of the SelectionEnd property cannot be greater than the value of the Maximum property and cannot be less than the value of the Minimum property. SelectionEnd 属性的值还必须大于或等于 SelectionStart 属性的值。The value of the SelectionEnd property must also be greater than or equal to the value of the SelectionStart property. 如果 SelectionEnd 属性的值大于 Maximum 属性的值或小于 Minimum 属性的值,则该值将分别设置为 MaximumMinimum 属性的值。If the value of the SelectionEnd property is greater than the value of the Maximum property or less than the value of the Minimum property, the value is set to the value of the Maximum or Minimum property respectively.

依赖项属性信息Dependency Property Information

标识符字段Identifier Field SelectionEndProperty
元数据属性设置为 trueMetadata properties set to true BindsTwoWayByDefault

适用于

另请参阅