ARTICLE

Working with Slider in WPF

Posted by Manish Tewatia Articles | WPF using VB.NET September 09, 2010
In this article you will learn how to work with Slider control in WPF.
 
Reader Level:

Slider: The Slider is a specialized control that's occasionally useful. This control comes to simplify the process of coding for some UI design cases where you need to let your user choose a value and change it and you update your interface based on user's choices.

The core feature of slider is to displays a WPF slider control in a menu element along with child menu that specify individual values, and the range for the entire slider does not have to be linear. The range is only linear between individual slider tick stops.

The key Slider properties are defined in the RangeBase class. Along with these, you can use all the properties listed below:

  • Orientation

  • Delay and Interval

  • TickPlacement

  • TickFrequency

  • Ticks

  • IsSnapToTickEnabled

  • IsSelectionRangeEnabled

Example of an Slider control
XMAL Code

<Window x:Class="ClassicControls.SlidersCompared"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="SlidersCompared" Height="350" Width="450">
    <Grid>
        <StackPanel Margin="10">
            <TextBlock Margin="0,15,0,5">A Tick Mark Slider</TextBlock>
            <Slider Maximum="50" Value="15" TickFrequency="5"
                TickPlacement="BottomRight"></Slider>
        </StackPanel>
    </Grid>
</
Window>

Output window

slid.gif

Conclusion

Hope this article help you to understand the working of Slider control in WPF.

share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor