User Interface > Widgets > Range Based Widgets > Slider |
The slider is a widget that lets the user select a distinct value in a given range by dragging a thumb. A slider has the following structure:
The slider provides the following properties:
ENTicksPlacement | Description |
---|---|
None | Ticks are not drawn. |
TopLeft | Ticks are drawn on the top side of a horizontal axis or on the left side of a vertical axis. |
BottomRight | Ticks are drawn on the bottom side of a horizontal axis or on the right side of a vertical axis. |
Both | Ticks are drawn on both sides of the axis. |
The following piece of code demonstrates how to create a slider and handle its ValueChanged event:
Slider Example |
Copy Code
|
---|---|
NSlider slider = new NSlider(); slider.HorizontalPlacement = ENHorizontalPlacement.Left; slider.PreferredWidth = 300; slider.ValueChanged += new Function<NValueChangeEventArgs>(OnSliderValueChanged); private void OnSliderValueChanged(NValueChangeEventArgs args) { double newValue = (double)args.NewValue; } |