Introduction to Slider Control WPF In VB.NET

Slider control minimum and maximum properties by default set 0 or 10. It exist in system.windows.controls namespace uses presentationframework.dll assembly.
  • 2108

Introduction

Here we see, How to use a slider control in WPF. Slider control minimum and maximum properties by default set 0 or 10. It exist in system.windows.controls namespace uses presentationframework.dll assembly. Width and height property of this control shows the height and width of this. We uses xaml to write the slider code. We can use horizontal and Vertical slider also in WPF.

Slider Code in xaml

<Slider></Slider>

By default slider will look like this in our page.

simple.png
 

Figure 1

Horizontal slider-  in this slider range from -100 to +100 with five discrete values. Here is a example of horizontal slider. We can change the background colour by using of background property.


 

newhr.jpg
 

Figure 2

Vertical slider-  in this vertical slider range from 0 to 100. Here is a example of vertical slider. We can change the background colour by using of background property.


 

vrtsldr.png
 

Figure 3

Slider foreground and Background- here is code by which we can change or set the slider background and foreground of slider control.

<Windowx:Class="MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow"Height="350" Width="525">
<Grid>
<
Slider Height="23" HorizontalAlignment="Left" Margin="96,116,0,0" Name="Slider1"VerticalAlignment="Top" Width="265" Background="#FFF23B3B" BorderBrush="#FFE42323"Foreground="#FF001900" OpacityMask="#FF8AE18A" VerticalContentAlignment="Center"FontStyle="Italic" />
</
Grid>
</
Window>

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.