Class Slider
Represents a slider control (also known as track bar).
[DefaultBindingProperty("Value")]
[ControlCategory("Common")]
public class Slider : Control, IBaseObject, IDisposableObject, IInputElement, ISupportInitialize, IFocusable, IWin32Window, ITextProperty, IComponent, IDisposable
- Inheritance
-
Slider
- Implements
- Derived
- Extension Methods
Examples
Here is how to declare a Slider in UIXML:
<Slider Name="slider" Minimum="50" Maximum="250" Value="125" Margin="8" ValueChanged="Slider_ValueChanged" />
And the corresponding event handler in the code-behind:
private void Slider_ValueChanged(object sender, EventArgs e)
{
string text = slider.Value.ToString();
MessageBox.Show(text, string.Empty);
}
Also, a Slider can be created from code:
var Slider = new Alternet.UI.Slider() { Minimum = 50, Maximum = 200, Value = 125, Margin = new Thickness(0, 0, 0, 5) };
Remarks
The Slider is a scrollable control similar to the scroll bar control. You can configure ranges through which the value of the Value property of a slider scrolls by setting the Minimum property to specify the lower end of the range and the Maximum property to specify the upper end of the range.
The slider can be displayed horizontally or vertically.
You can use this control to input numeric data obtained through the Value property. You can display this numeric data in a control or use it in code.
Examples of how a Slider can look on different platforms:
Set Value property to represent the current position of the scroll box on the slider.
A Slider, like any other Control, can be disabled by setting its Enabled property to false
.
Fields
- MaximumProperty
Identifies the Maximum dependency property.
- MinimumProperty
Identifies the Minimum dependency property.
- ValueProperty
Identifies the Value dependency property.
Properties
- ControlKind
Returns control identifier.
- LargeChange
Gets or sets a value to be added to or subtracted from the Value property when the scroll box is moved a large distance.
- Orientation
Gets or sets a value indicating the horizontal or vertical orientation of the slider.
- SmallChange
Gets or sets the value added to or subtracted from the Value property when the scroll box is moved a small distance.
- TickFrequency
Gets or sets a value that specifies the delta between ticks drawn on the control.
- TickStyle
Gets or sets a value indicating how to display the tick marks on the slider.
- Value
Gets or sets a numeric value that represents the current position of the scroll box on the slider.
Methods
- BindValue(string)
Binds Value to the specified property of the DataContext
- ClearTicks()
Clears the ticks.
- OnMaximumChanged(EventArgs)
Called when the maximum of the Maximum property changes.
- OnMinimumChanged(EventArgs)
Called when the minimum of the Minimum property changes.
- OnValueChanged(EventArgs)
Called when the value of the Value property changes.
- RaiseValueChanged(EventArgs)
Raises the ValueChanged event and calls OnValueChanged(EventArgs).
Events
- LargeChangeChanged
Occurs when the value of the LargeChange property changes.
- MaximumChanged
Occurs when the value of the Maximum property changes.
- MinimumChanged
Occurs when the value of the Minimum property changes.
- SmallChangeChanged
Occurs when the value of the SmallChange property changes.
- TickFrequencyChanged
Occurs when the value of the TickFrequency property changes.
- ValueChanged
Occurs when the Value property of a slider changes, either by movement of the scroll box or by manipulation in code.