Slider Class
Namespace: Stride.UI.ControlsAssembly: Stride.UI.dll
Represents a slider element.
[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() | ||
Increase() | ||
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. |
Constructors
Slider()
Create a new instance of slider.
public Slider()
Fields
ValueChangedEvent
Identifies the ValueChanged routed event.
public static readonly RoutedEvent<RoutedEventArgs> ValueChangedEvent
Field Value
Type | Description |
---|---|
RoutedEvent<RoutedEventArgs> |
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
| Improve this Doc View SourceMethods
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()
public void Decrease()
Remarks
If ShouldSnapToTicks is
Increase()
public void Increase()
Remarks
If ShouldSnapToTicks is
MeasureOverride(Vector3)
protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | availableSizeWithoutMargins |
Returns
Type | Description |
---|---|
Vector3 |
Overrides
OnTouchDown(TouchEventArgs)
protected override void OnTouchDown(TouchEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TouchEventArgs | args |
Overrides
OnTouchLeave(TouchEventArgs)
protected override void OnTouchLeave(TouchEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TouchEventArgs | args |
Overrides
OnTouchMove(TouchEventArgs)
protected override void OnTouchMove(TouchEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TouchEventArgs | args |
Overrides
OnTouchUp(TouchEventArgs)
protected override void OnTouchUp(TouchEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
TouchEventArgs | args |
Overrides
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
| Improve this Doc View SourceEvents
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