Scrolling in Silverlight

Silk4J provides two different sets of scrolling-related methods and properties, depending on the Silverlight control.
  • The first type of controls includes controls that can scroll by themselves and therefore do not expose the scrollbars explicitly as children. For example combo boxes, panes, list boxes, tree controls, data grids, auto complete boxes, and others.
  • The second type of controls includes controls that cannot scroll by themselves but expose scrollbars as children for scrolling. For example text fields.
This distinction in Silk4J exists because the controls in Silk4J implement scrolling in those two ways.

Controls that support scrolling

In this case, scrolling-related methods and property are available for the control that contains the scrollbars. Therefore, Silk4J does not expose scrollbar objects.

Examples

The following command scrolls a list box to the bottom:
listBox.SetVerticalScrollPercent(100)
The following command scrolls the list box down by one unit:
listBox.ScrollVertical(ScrollAmount.SmallIncrement)

Controls that do not support scrolling

In this case the scrollbars are exposed. No scrolling-related methods and properties are available for the control itself. The horizontal and vertical scrollbar objects enable you to scroll in the control by specifying the increment or decrement, or the final position, as a parameter in the corresponding API functions. The increment or decrement can take the values of the ScrollAmount enumeration. For additional information, refer to the Silverlight documentation. The final position is related to the position of the object, which is defined by the application designer.

Examples

The following command scrolls a vertical scrollbar within a text box to position 15:
 textBox.SLVerticalScrollBar().ScrollToPosition(15)
The following command scrolls a vertical scrollbar within a text box to the bottom:
 textBox.SLVerticalScrollBar().ScrollToMaximum()