Table of Contents

Class Slider

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Represents a slider control (also known as track bar).

[DefaultBindingProperty("Value")]
[ControlCategory("Common")]
public class Slider : Control, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
Slider
Implements

Examples

Here is how to declare a Slider in UIXML:

<Slider Name="slider" Minimum="50" Maximum="250" Value="125" Margin="8"
        TickFrequency="15" ValueChanged="Slider_ValueChanged" />

And the corresponding event handler in the code-behind:

private void Slider_ValueChanged(object sender, EventArgs e)
{
    Title = slider.Value.ToString();
}

Also, a Slider can be created from code:

var Slider = new Alternet.UI.Slider()
{
    Minimum = 50,
    Maximum = 200,
    Value = 125,
    TickFrequency = 10,                
    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.

Properties

ControlKind

Returns control identifier.

Handler

Gets control handler.

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.

Maximum

Gets or sets the upper limit of the range this Slider is working with.

Minimum

Gets or sets the lower limit of the range this Slider is working with.

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

ClearTicks()

Clears the ticks.

CreateHandler()

Creates a handler for the control.

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()

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.

OrientationChanged

Occurs when the value of the Orientation property changes.

SmallChangeChanged

Occurs when the value of the SmallChange property changes.

TickFrequencyChanged

Occurs when the value of the TickFrequency property changes.

TickStyleChanged

Occurs when the value of the TickStyle property changes.

ValueChanged

Occurs when the Value property of a slider changes, either by movement of the scroll box or by manipulation in code.