
You already have a Method GetColor() which updates StackPanel Background. The hierarchical inheritance of Slider class is as follows Commonly Used Properties of Slider Given below are the most commonly used properties of Slider. To Bind the TextBlocks with Value of Slider, I used Behaviours. A slider is a control with the help of which a user can select from a range of values by moving a Thumb control along a track. Private void slider3_ValueChanged(object sender, RoutedPropert圜hangedEventArgs e) / This event is called whenever value of the slider3 control is changed. Private void slider2_ValueChanged(object sender, RoutedPropert圜hangedEventArgs e) / This event is called whenever the value of slider2 control is changed. Private void slider1_ValueChanged(object sender, RoutedPropert圜hangedEventArgs e) / This event is called whenever the value of slider1 control is changed. Private void Window_Loaded(object sender, RoutedEventArgs e) / And change the background of panel control.

/ This event is called when the window is first time loaded in memory StackPanel1.Background = colorBrush //Setting background of stack panel. SolidColorBrush colorBrush = new SolidColorBrush(cc) //Creating object of SolidColorBruch class. / slider one, two, three and then change the background colorīyte rr = (byte)slider1.Value //Retriving values from slider1īyte gg = (byte)slider2.Value //Retriving values from slider2īyte bb = (byte)slider3.Value //Retriving values from slider3Ĭolor cc = Color.FromRgb(rr, gg, bb) //Create object of Color class. / This method is used to create color by taking values from SolidColorBrush colorBrush = (SolidColorBrush)stackPanel1.Background

Private void button1_Click(object sender, RoutedEventArgs e) / which sets with the help of slider control and display it in message box.
#Slider control in paintcode code
/ On the click event of the GetColor() button we het the color code Can someone please assist me? I have look long and hard for a method but nothing seems to work. I need to be able to change the background color of a canvas based on the sliders value.
