Integration of the slider in WPF is very easy. Just place <Slider /> in your XAML page, and it will start working. But to customize it further, let's follow these steps:
- Open the MainWindow.xaml page, and replace the default Grid with a StackPanel.
- Now add a Slider and a TextBlock control inside the StackPanel, as shown in the following XAML snippet:
<StackPanel Margin="10"> <Slider x:Name="slider" Minimum="0" Maximum="100" Value="25" SmallChange="1" LargeChange="5" /> <TextBlock Margin="4"> <Run Text="Current slider value: " /> <Run Text="{Binding Value, ElementName=slider}" /> </TextBlock> </StackPanel>
- Run the application. You will see a Slider control in the UI, along with a text that shows the current value, which...