Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 3rd, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to make TextBlock.Text = Slider.Value on slider value change
  2. If Slider1.Value = 1 Then
  3.         TextBlock1.Text = "1"
  4.     End If
  5.     If Slider1.Value = 2 Then
  6.         TextBlock1.Text = "2"
  7.     End If
  8.     If Slider1.Value = 3 Then
  9.         TextBlock1.Text = "3"
  10.     End If
  11.     If Slider1.Value = 4 Then
  12.         TextBlock1.Text = "4"
  13.     End If
  14.     If Slider1.Value = 5 Then
  15.         TextBlock1.Text = "5"
  16.     End If
  17.        
  18. If Slider1.Value = 1 Then
  19.     TextBlock1.Text = "1"
  20.     End If
  21.        
  22. <Slider x:Name="mySlider"/>
  23.   <TextBox x:Name="myTextBox" Text="{Binding ElementName=mySlider,Path=Value}"/>
  24.        
  25. <Slider x:Name="mySlider" ValueChanged="mySlider_ValueChanged"/>
  26.        
  27. Private Sub mySlider_ValueChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of Double))
  28.     myTextBox.Text = e.NewValue.ToString()
  29. End Sub