XAML ScrollBar

The <ScrollBar> element of XAML represents a scroll bar control in UI. The ScrollBar control is used to add horizontal and vertical scroll bars to content controls. This tutorial and code examples show how to use a ScrollBar control in a WPF app using XAML.
 
XAML Scrollbar  
 
The following code example creates a ScrollBar. The Orientation property of ScrollBar element sets the direction of scrolling that can  either be horizontal or vertical. The Backtround property sets the background color of a scroll bar.
  1. <ScrollBar Name="McScroller" Orientation="Horizontal"  
  2. Width ="250" Height="30"  
  3. Margin="10,10,0,0"  
  4. Background="LightSalmon" />  
The Value property of ScrollBar sets up the current value of a ScrollBar control. The Minimum and Maximum properties represent the minimum and maximum range of a ScrollBar. In the following code, I set the Value property to 50 and now the ScrollBar.  
  1. <ScrollBar Name="McScroller" Orientation="Horizontal"  
  2. Margin="10,10,0,0"  
  3. Width ="250" Height="30"  
  4. Background="LightSalmon"  
  5. Minimum="1" Maximum="240"  
  6. Value="50" />  
Here is a complete tutorial - WPF ToolBar Control using XAML and C#
 


Recommended Free Ebook
Similar Articles
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.