How to: Create a ScrollBar
This example shows how to create a ScrollBar.
Example
The following example creates a horizontal ScrollBar.
hscrollb = new ScrollBar();
hscrollb.Orientation = Orientation.Horizontal;
spanel2.Children.Add(hscrollb);
The following example creates a vertical ScrollBar.
vscrollb = new ScrollBar();
vscrollb.Orientation = Orientation.Vertical;
vscrollb.HorizontalAlignment = HorizontalAlignment.Left;
vscrollb.Width = (20);
vscrollb.Height = (80);
Canvas.SetLeft(vscrollb, (50));
spanel2.Children.Add(vscrollb);
For the complete sample, which shows how to create several controls and includes a horizontal and vertical ScrollBar, see Creating Controls Sample.