RadScrollBarElement
Implements the basic functionality for scrolling.
This class can be used both for horizontal and for vertical scrolling via its property ScrollType. In the Toolbox only the specialized children are put: RadHScrollBar and RadVScrollBar.
To adjust the value range of the scroll bar control, set the Minimum and Maximum properties. To adjust the distance the scroll thumb moves, set the SmallChange and LargeChange properties. To adjust the starting point of the scroll thumb, set the Value property when the control is initially displayed.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
[ComVisible(false)]
public class RadScrollBarElement : RadItem, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemRadScrollBarElement...
Implements:
Inherited Members
Constructors
public RadScrollBarElement()
Fields
public const ScrollType DefaultScrollType = Horizontal
Identifies the GradientAngleCorrection dependency property.
public static readonly RadProperty GradientAngleCorrectionProperty
Gets or sets the default height for horizontal scroll bars.
public static int HorizontalScrollBarHeight
Identifies the IsMouseOverScrollBar dependency property.
public static readonly RadProperty IsMouseOverScrollBarProperty
Identifies the MinThumbLength dependency property.
public static readonly RadProperty MinThumbLengthProperty
Identifies the Pressed dependency property.
public static readonly RadProperty PressedProperty
Identifies the ScrollType dependency property.
public static readonly RadProperty ScrollTypeProperty
Identifies the ThumbLengthProportion dependency property.
public static readonly RadProperty ThumbLengthProportionProperty
Gets or sets the default width for vertical scroll bars.
public static int VerticalScrollBarWidth
Properties
Gets the border primitive that renders the scroll bar's outline.
public BorderPrimitive BorderElement { get; }
Indicates whether invalid values should be clamped or an exception should be thrown
public bool ClampValue { get; set; }
Gets the fill primitive that renders the scroll bar's background.
public FillPrimitive FillElement { get; }
Gets the first button element of this scrollbar
public ScrollBarButton FirstButton { get; }
Controls the angle that the fill primitive will be rotated when switching from horizontal to vertical orientation
public float GradientAngleCorrection { get; set; }
Gets or sets a value to be added to or subtracted from the Value property when the scroll thumb is moved a large distance.
public int LargeChange { get; set; }
A numeric value. The default value is 10.
When the user presses the PAGE UP or PAGE DOWN key, clicks in the scroll bar track on either side of the scroll thumb, or calls one of the PageXXX() functions, the Value property changes according to the value set in the LargeChange property.
Gets or sets the upper limit of the scrollable range.
public int Maximum { get; set; }
A numeric value. The default value is 100.
NOTE: The value of a scroll bar cannot reach its maximum value through user interaction at run time. The maximum value that can be reached is equal to the Maximum property value minus the LargeChange property value plus 1. The maximum value can only be reached programmatically.
Gets or sets the lower limit for the values of the scrollable range.
public int Minimum { get; set; }
A numeric value. The default value is 0.
Gets or sets the minimum length of the scrolling thumb. See ThumbLength for more information about thumb length.
public int MinThumbLength { get; set; }
An integer value that gives the minimum thumb length. It is taken into account no matter if the thumb length is calculated automatically or the thumb length is set explicitly. The thumb length could be smaller than MinThumbLength if there is no space in the scroll bar.
Gets or sets the scroll timer delay
[Browsable(false)]
public int ScrollTimerDelay { get; set; }
Gets or sets the ScrollType - it could be horizontal or vertical.
public ScrollType ScrollType { get; set; }
Gets the second button element of this scrollbar
public ScrollBarButton SecondButton { get; }
Gets or sets the value to be added to or subtracted from the Value property when the scroll thumb is moved a small distance.
public int SmallChange { get; set; }
A numeric value. The default value is 1.
When the user presses one of the arrow keys, clicks one of the scroll bar buttons or calls one of the LineXXX() functions, the Value property changes according to the value set in the SmallChange property.
Gets the thumb element of this scrollbar
[Browsable(false)]
public ScrollBarThumb ThumbElement { get; }
Gets the length of the scrolling thumb. Thumb length is the thumb's height for vertical scroll bar and the thumb's width for horizontal scroll bar.
public int ThumbLength { get; }
Gets or sets a value between 0.0 and 1.0 that indicates what part of the scrollable area can be occupied by the thumb. If the value is 0.0 then the thumb should be with length 0 but the property MinThumbLength will cause the thumb to be larger. If the value is 1.0 the thumb takes the whole area between the two scrolling buttons. Negative value means that the thumb length should be calculated automatically based on Minimum, Maximum and LargeChange values.
public double ThumbLengthProportion { get; set; }
Methods
Creates the track fill, arrow buttons, thumb, and border primitives that make up the scrollbar.
protected override void CreateChildElements()
Overrides:
Detaches and disposes the timers used for repeated scrolling.
protected override void DisposeManagedResources()
Overrides:
Retrieves the srolling parameters.
Gets the Vista visual style element for this scroll bar.
public override VisualStyleElement GetVistaVisualStyle()
The Vista visual style element.
Overrides:
Gets the XP visual style element for this scroll bar.
public override VisualStyleElement GetXPVisualStyle()
The XP visual style element.
Overrides:
Creates the delay and repeat timers used while a scrollbar track is held.
protected override void InitializeFields()
Overrides:
Removes the thumb margin while system-skin rendering is active so it aligns with the native track.
protected override void InitializeSystemSkinPaint()
Overrides:
Measures the arrow buttons and thumb along the scrolling axis, including padding and border.
Recalculates the fill-gradient correction after the element is loaded.
protected override void OnLoaded()
Overrides:
Captures a left-button press on a track region and starts delayed repeat scrolling.
protected override void OnMouseDown(MouseEventArgs e)
The pressed button and pointer location.
Overrides:
Stops the repeat timer when the pointer leaves and the scrollbar does not hold capture.
protected override void OnMouseLeave(EventArgs e)
The event data for the mouse-leave notification.
Overrides:
Stops repeated scrolling, releases mouse capture, and ends the current scroll interaction.
protected override void OnMouseUp(MouseEventArgs e)
The released button and pointer location.
Overrides:
Moves the thumb along the active axis in response to a pan and raises Scroll when the resulting value changes.
protected override void OnPanGesture(PanGestureEventArgs args)
The gesture offset and handled state.
Overrides:
Updates orientation-dependent button directions, thumb sizing, hover state, or active scrolling when the corresponding properties change.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
The property change being processed.
Overrides:
Raises the Scroll event with the specified arguments.
protected virtual void OnScroll(ScrollEventArgs args)
The scroll event data describing the type and amount of the scroll action.
Raises the ScrollParameterChanged event, unless the event is currently suppressed (for example while SetParameters(ScrollBarParameters) is applying multiple values at once).
protected virtual void OnScrollParameterChanged()
Raises the ValueChanged event with an empty EventArgs.
protected virtual void OnValueChanged()
Raises the ValueChanged event with a ScrollEventArgs describing the value transition and the scroll orientation determined by ScrollType.
Selects orientation- and state-specific system visual-style parts for the track and delegates their rendering.
protected override void PaintElementSkin(IGraphics graphics)
The graphics context used to paint the track.
Overrides:
protected virtual void PaintHorizontalVisualStylesElements()
protected virtual void PaintVerticalVisualStyleElements()
Paints one native visual-style part when the target supports system-skin rendering.
protected virtual void PaintVisualStyleElement(Graphics graphics, VisualStyleElement element, Rectangle bounds)
The graphics context for painting.
elementVisualStyleElementThe visual-style part to render.
boundsRectangleThe bounds in which to render the part.
Simulate scrolling with positioning the thumb on its first position. Unlike setting property Value this function fires scrolling events.
public void PerformFirst()
Simulate scrolling - just like the top / left area according the thumb is pressed. Unlike setting property Value this function fires scrolling events.
public void PerformLargeDecrement(int numSteps)
Value is decremented with (numSteps * LargeChange)
Simulate scrolling - just like the bottom / right area according the thumb is pressed. Unlike setting property Value this function fires scrolling events.
public void PerformLargeIncrement(int numSteps)
Value is incremented with (numSteps * LargeChange)
Simulate scrolling with positioning the thumb on its last position. Unlike setting property Value this function fires scrolling events.
public void PerformLast()
Scrolls just like the thumb is dragged at given position
public void PerformScrollTo(Point position)
Position of the thumb (in screen coordinates).
Simulate scrolling - just like the top / left button is pressed. Unlike setting property Value this function fires scrolling events.
public void PerformSmallDecrement(int numSteps)
Value is decremented with (numSteps * SmallChange)
Simulate scrolling - just like the bottom / right button is pressed. Unlike setting property Value this function fires scrolling events.
public void PerformSmallIncrement(int numSteps)
Value is incremented with (numSteps * SmallChange)
Sets the given scroll parameters.
public void SetParameters(ScrollBarParameters parameters)
Suppresses the custom fill and border primitives when the system skin paints the scrollbar.
protected override bool ShouldPaintChild(RadElement element)
The child element being considered for painting.
Returns:false for the custom fill and border during system-skin painting; otherwise, the base decision.
Overrides:
Clears the temporary local thumb margin applied for system-skin rendering.
protected override void UnitializeSystemSkinPaint()
Overrides:
Events
Occurs when the scroll thumb has been moved by either a mouse or keyboard action.
public event ScrollEventHandler Scroll
Occurs when a property that affects the scrolling is changed. See ScrollBarParameters for more information on which properties affect the scrolling.
public event EventHandler ScrollParameterChanged