Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Slider Class

    Namespace: Stride.UI.Controls
    Assembly: Stride.UI.dll

    Represents a slider element.

    System.Object → UIElement → Slider
    Derived from Slider:

    [DataContract("Slider")]
    [DataContractMetadataType(typeof(Slider.SliderMetadata))]
    [Display(null, "Input")]
    public class Slider : UIElement, IUIElementUpdate, IUIElementChildren, IIdentifiable
    Name Description
    Constructors
    Slider()

    Create a new instance of slider.

    Fields
    ValueChangedEvent

    Identifies the ValueChanged routed event.

    Properties
    AreTicksDisplayed

    Gets or sets the value indicating if the ticks should be displayed or not.

    IsDirectionReversed

    Gets or sets the value indicating if the default direction of the slider should reversed or not.

    IsTouchedDown

    Gets a value that indicates whether the is currently touched down.

    Maximum

    Gets or sets the greatest possible value of the slider.

    Minimum

    Gets or sets the smallest possible value of the slider.

    MouseOverThumbImage

    Gets or sets the image to display as slider thumb (button) when the mouse is over the slider.

    Orientation

    Gets or sets the orientation of the slider.

    ShouldSnapToTicks

    Gets or sets the value indicating if the slider Value should be snapped to the ticks or not.

    Step

    Gets or sets the step of a Value change.

    ThumbImage

    Gets or sets the image to display as slider thumb (button).

    TickFrequency

    Gets or sets the frequency of the ticks on the slider track.

    TickImage

    Gets or sets the image to display as tick.

    TickOffset

    Gets or sets the offset in virtual pixels between the center of the track and center of the ticks (for an not-stretched slider).

    TrackBackgroundImage

    Gets or sets the image to display as Track background.

    TrackForegroundImage

    Gets or sets the image to display as Track foreground.

    TrackStartingOffsets

    Gets or sets the left/right offsets specifying where the track region starts.

    Value

    Gets or sets the current value of the slider.

    Methods
    CalculateClosestTick(Single)

    Calculate the value of the closest tick to the provided value.

    Decrease()

    Decrease the Value by Step.

    Increase()

    Increase the Value by Step.

    MeasureOverride(Vector3)
    OnTouchDown(TouchEventArgs)
    OnTouchLeave(TouchEventArgs)
    OnTouchMove(TouchEventArgs)
    OnTouchUp(TouchEventArgs)
    OnValueChanged(RoutedEventArgs)

    The class handler of the event ValueChanged. This method can be overridden in inherited classes to perform actions common to all instances of a class.

    SetValueFromTouchPosition(Vector3)

    Set Value from the world position of a touch event.

    SnapToClosestTick()

    Snap the current Value to the closest tick.

    Update(GameTime)
    Events
    ValueChanged

    Occurs when the value of the slider changed.

    | Improve this Doc View Source

    Constructors


    Slider()

    Create a new instance of slider.

    public Slider()
    | Improve this Doc View Source

    Fields


    ValueChangedEvent

    Identifies the ValueChanged routed event.

    public static readonly RoutedEvent<RoutedEventArgs> ValueChangedEvent
    Field Value
    Type Description
    RoutedEvent<RoutedEventArgs>
    | Improve this Doc View Source

    Properties


    AreTicksDisplayed

    Gets or sets the value indicating if the ticks should be displayed or not.

    [DataMember]
    [Display(null, "Appearance")]
    public bool AreTicksDisplayed { get; set; }
    Property Value
    Type Description
    System.Boolean

    IsDirectionReversed

    Gets or sets the value indicating if the default direction of the slider should reversed or not.

    [DataMember]
    [Display(null, "Behavior")]
    public bool IsDirectionReversed { get; set; }
    Property Value
    Type Description
    System.Boolean

    IsTouchedDown

    Gets a value that indicates whether the is currently touched down.

    protected virtual bool IsTouchedDown { get; set; }
    Property Value
    Type Description
    System.Boolean

    Maximum

    Gets or sets the greatest possible value of the slider.

    [DataMember]
    public float Maximum { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [Minimum, System.Single.MaxValue].


    Minimum

    Gets or sets the smallest possible value of the slider.

    [DataMember]
    public float Minimum { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [System.Single.MinValue, System.Single.MaxValue].


    MouseOverThumbImage

    Gets or sets the image to display as slider thumb (button) when the mouse is over the slider.

    [DataMember]
    [Display(null, "Appearance")]
    public ISpriteProvider MouseOverThumbImage { get; set; }
    Property Value
    Type Description
    ISpriteProvider

    Orientation

    Gets or sets the orientation of the slider.

    [DataMember]
    [Display(null, "Layout")]
    public Orientation Orientation { get; set; }
    Property Value
    Type Description
    Orientation

    ShouldSnapToTicks

    Gets or sets the value indicating if the slider Value should be snapped to the ticks or not.

    [DataMember]
    [Display(null, "Behavior")]
    public bool ShouldSnapToTicks { get; set; }
    Property Value
    Type Description
    System.Boolean

    Step

    Gets or sets the step of a Value change.

    [DataMember]
    [DataMemberRange(0, 3)]
    public float Step { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [0, System.Single.MaxValue].


    ThumbImage

    Gets or sets the image to display as slider thumb (button).

    [DataMember]
    [Display(null, "Appearance")]
    public ISpriteProvider ThumbImage { get; set; }
    Property Value
    Type Description
    ISpriteProvider

    TickFrequency

    Gets or sets the frequency of the ticks on the slider track.

    [DataMember]
    [DataMemberRange(1, 3)]
    [Display(null, "Appearance")]
    public float TickFrequency { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [1, System.Single.MaxValue].


    TickImage

    Gets or sets the image to display as tick.

    [DataMember]
    [Display(null, "Appearance")]
    public ISpriteProvider TickImage { get; set; }
    Property Value
    Type Description
    ISpriteProvider

    TickOffset

    Gets or sets the offset in virtual pixels between the center of the track and center of the ticks (for an not-stretched slider).

    [DataMember]
    [DataMemberRange(0, 3)]
    [Display(null, "Appearance")]
    public float TickOffset { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [0, System.Single.MaxValue].


    TrackBackgroundImage

    Gets or sets the image to display as Track background.

    [DataMember]
    [Display(null, "Appearance")]
    public ISpriteProvider TrackBackgroundImage { get; set; }
    Property Value
    Type Description
    ISpriteProvider

    TrackForegroundImage

    Gets or sets the image to display as Track foreground.

    [DataMember]
    [Display(null, "Appearance")]
    public ISpriteProvider TrackForegroundImage { get; set; }
    Property Value
    Type Description
    ISpriteProvider

    TrackStartingOffsets

    Gets or sets the left/right offsets specifying where the track region starts.

    [DataMember]
    [Display(null, "Appearance")]
    public Vector2 TrackStartingOffsets { get; set; }
    Property Value
    Type Description
    Vector2

    Value

    Gets or sets the current value of the slider.

    [DataMember]
    public float Value { get; set; }
    Property Value
    Type Description
    System.Single
    Remarks

    The value is coerced in the range [Minimum, Maximum].

    | Improve this Doc View Source

    Methods


    CalculateClosestTick(Single)

    Calculate the value of the closest tick to the provided value.

    protected float CalculateClosestTick(float rawValue)
    Parameters
    Type Name Description
    System.Single rawValue

    The current raw value

    Returns
    Type Description
    System.Single

    The value adjusted to the closest tick


    Decrease()

    Decrease the Value by Step.

    public void Decrease()
    Remarks

    If ShouldSnapToTicks is True then it decreases of at least one tick.


    Increase()

    Increase the Value by Step.

    public void Increase()
    Remarks

    If ShouldSnapToTicks is True then it increases of at least one tick.


    MeasureOverride(Vector3)

    protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)
    Parameters
    Type Name Description
    Vector3 availableSizeWithoutMargins
    Returns
    Type Description
    Vector3
    Overrides
    UIElement.MeasureOverride(Vector3)

    OnTouchDown(TouchEventArgs)

    protected override void OnTouchDown(TouchEventArgs args)
    Parameters
    Type Name Description
    TouchEventArgs args
    Overrides
    UIElement.OnTouchDown(TouchEventArgs)

    OnTouchLeave(TouchEventArgs)

    protected override void OnTouchLeave(TouchEventArgs args)
    Parameters
    Type Name Description
    TouchEventArgs args
    Overrides
    UIElement.OnTouchLeave(TouchEventArgs)

    OnTouchMove(TouchEventArgs)

    protected override void OnTouchMove(TouchEventArgs args)
    Parameters
    Type Name Description
    TouchEventArgs args
    Overrides
    UIElement.OnTouchMove(TouchEventArgs)

    OnTouchUp(TouchEventArgs)

    protected override void OnTouchUp(TouchEventArgs args)
    Parameters
    Type Name Description
    TouchEventArgs args
    Overrides
    UIElement.OnTouchUp(TouchEventArgs)

    OnValueChanged(RoutedEventArgs)

    The class handler of the event ValueChanged. This method can be overridden in inherited classes to perform actions common to all instances of a class.

    protected virtual void OnValueChanged(RoutedEventArgs args)
    Parameters
    Type Name Description
    RoutedEventArgs args

    The arguments of the event


    SetValueFromTouchPosition(Vector3)

    Set Value from the world position of a touch event.

    protected void SetValueFromTouchPosition(Vector3 touchPostionWorld)
    Parameters
    Type Name Description
    Vector3 touchPostionWorld

    The world position of the touch


    SnapToClosestTick()

    Snap the current Value to the closest tick.

    public void SnapToClosestTick()

    Update(GameTime)

    protected override void Update(GameTime time)
    Parameters
    Type Name Description
    GameTime time
    Overrides
    UIElement.Update(GameTime)
    | Improve this Doc View Source

    Events


    ValueChanged

    Occurs when the value of the slider changed.

    public event EventHandler<RoutedEventArgs> ValueChanged
    Event Type
    Type Description
    System.EventHandler<RoutedEventArgs>
    Remarks

    A ValueChanged event is bubbling


    Inherited Members

    UIElement.InputCategory
    UIElement.PanelCategory
    UIElement.AppearanceCategory
    UIElement.BehaviorCategory
    UIElement.LayoutCategory
    UIElement.MiscCategory
    UIElement.MarginInternal
    UIElement.ArrangeChanged
    UIElement.LocalMatrixChanged
    UIElement.Id
    UIElement.DependencyProperties
    UIElement.LocalMatrix
    UIElement.BackgroundColor
    UIElement.Opacity
    UIElement.Visibility
    UIElement.ClipToBounds
    UIElement.DrawLayerNumber
    UIElement.IsEnabled
    UIElement.CanBeHitByUser
    UIElement.Width
    UIElement.Height
    UIElement.Depth
    UIElement.Size
    UIElement.HorizontalAlignment
    UIElement.VerticalAlignment
    UIElement.DepthAlignment
    UIElement.Margin
    UIElement.MinimumWidth
    UIElement.MinimumHeight
    UIElement.MinimumDepth
    UIElement.MaximumWidth
    UIElement.MaximumHeight
    UIElement.MaximumDepth
    UIElement.DefaultWidth
    UIElement.DefaultHeight
    UIElement.DefaultDepth
    UIElement.Name
    UIElement.DesiredSize
    UIElement.DesiredSizeWithMargins
    UIElement.IsArrangeValid
    UIElement.IsMeasureValid
    UIElement.WorldMatrix
    UIElement.DepthBias
    UIElement.LayoutingContext
    UIElement.VisualChildrenCollection
    UIElement.InvalidateArrange()
    UIElement.InvalidateMeasure()
    UIElement.OnNameChanged()
    UIElement.IsHierarchyEnabled
    UIElement.IsVisible
    UIElement.IsCollapsed
    UIElement.Parent
    UIElement.VisualParent
    UIElement.VisualChildren
    UIElement.HitableChildren
    UIElement.RenderOpacity
    UIElement.RenderSize
    UIElement.RenderOffsets
    UIElement.ActualWidth
    UIElement.ActualHeight
    UIElement.ActualDepth
    UIElement.IUIElementChildren.Children
    UIElement.EnumerateChildren()
    UIElement.Measure(Vector3)
    UIElement.Arrange(Vector3, Boolean)
    UIElement.ArrangeOverride(Vector3)
    UIElement.CollapseOverride()
    UIElement.PropagateCollapseToChild(UIElement)
    UIElement.FindName(String)
    UIElement.SetParent(UIElement, UIElement)
    UIElement.SetVisualParent(UIElement, UIElement)
    UIElement.Intersects(Ray, Vector3)
    UIElement.IUIElementUpdate.Update(GameTime)
    UIElement.IUIElementUpdate.UpdateWorldMatrix(Matrix, Boolean)
    UIElement.IUIElementUpdate.UpdateElementState(Int32)
    UIElement.UpdateWorldMatrix(Matrix, Boolean)
    UIElement.CalculateSizeWithThickness(Vector3, Thickness)
    UIElement.CalculateSizeWithoutThickness(Vector3, Thickness)
    UIElement.CalculateAdjustmentOffsets(Thickness, Vector3, Vector3)
    UIElement.IsTouched
    UIElement.MouseOverState
    UIElement.RequiresMouseOverUpdate
    UIElement.RaiseEvent(RoutedEventArgs)
    UIElement.AddHandler<T>(RoutedEvent<T>, EventHandler<T>, Boolean)
    UIElement.RemoveHandler<T>(RoutedEvent<T>, EventHandler<T>)
    UIElement.MouseOverStateChanged
    UIElement.PreviewTouchDown
    UIElement.PreviewTouchMove
    UIElement.PreviewTouchUp
    UIElement.TouchDown
    UIElement.TouchEnter
    UIElement.TouchLeave
    UIElement.TouchMove
    UIElement.TouchUp
    UIElement.OnPreviewTouchDown(TouchEventArgs)
    UIElement.OnPreviewTouchMove(TouchEventArgs)
    UIElement.OnPreviewTouchUp(TouchEventArgs)
    UIElement.OnTouchEnter(TouchEventArgs)

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    UIElementExtensions.SetPanelZIndex(UIElement, Int32)
    UIElementExtensions.GetPanelZIndex(UIElement)
    UIElementExtensions.SetCanvasRelativeSize(UIElement, Vector3)
    UIElementExtensions.GetCanvasRelativeSize(UIElement)
    UIElementExtensions.SetCanvasRelativePosition(UIElement, Vector3)
    UIElementExtensions.GetCanvasRelativePosition(UIElement)
    UIElementExtensions.SetCanvasAbsolutePosition(UIElement, Vector3)
    UIElementExtensions.GetCanvasAbsolutePosition(UIElement)
    UIElementExtensions.SetCanvasPinOrigin(UIElement, Vector3)
    UIElementExtensions.GetCanvasPinOrigin(UIElement)
    UIElementExtensions.SetGridColumn(UIElement, Int32)
    UIElementExtensions.GetGridColumn(UIElement)
    UIElementExtensions.SetGridRow(UIElement, Int32)
    UIElementExtensions.GetGridRow(UIElement)
    UIElementExtensions.SetGridLayer(UIElement, Int32)
    UIElementExtensions.GetGridLayer(UIElement)
    UIElementExtensions.SetGridColumnSpan(UIElement, Int32)
    UIElementExtensions.GetGridColumnSpan(UIElement)
    UIElementExtensions.SetGridRowSpan(UIElement, Int32)
    UIElementExtensions.GetGridRowSpan(UIElement)
    UIElementExtensions.SetGridLayerSpan(UIElement, Int32)
    UIElementExtensions.GetGridLayerSpan(UIElement)
    VisualTreeHelper.FindVisualChildOfType<T>(UIElement, String)
    VisualTreeHelper.FindVisualChildrenOfType<T>(UIElement)
    VisualTreeHelper.FindVisualParentOfType<T>(UIElement)
    VisualTreeHelper.FindVisualRoot(UIElement)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation