Hello, Welcome to Micorosoft Q&A,
Now what i want is to change the slider by itself by fetching the value stored in database value.
For updating slider value automatically, the better way is using mvvm binding, when you updated the binding property value(SliderValue), the slider will update the slider automatically. For more please refer the following sample code. For more detail please refer to Data binding document
public class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private double _sliderValue;
public double SliderValue { get { return _sliderValue; } set { _sliderValue = value; NotifyPropertyChanged(); } }
}
Xaml
<Grid>
<Grid.DataContext>
<local:ViewModel x:Name="MyModel" />
</Grid.DataContext>
<Slider
Maximum="150"
Minimum="20"
Value="{Binding SliderValue, Mode=TwoWay}" />
</Grid>
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.