title: WPF, VB.net, xaml change image visibility on slider value change
body: <p>Hi newbie here trying to change image visibility on slider value change I have tried three ways no luck</p>
  
  <ol>
  <li>using vb.net so </li>
  </ol>
  
  <pre><code>Private Sub SLIDERA_ValueChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of Double)) Handles SLIDERA.ValueChanged
  
  
         If SLIDERA.Value = 0 Then
  
             imageOFF.Visibility = Visibility.Hidden
             imageON.Visibility = Visibility.Visible
         End If
         If SLIDERA.Value = 0.5 Then
             imageOFF.Visibility = Visibility.Visible
             imageON.Visibility = Visibility.Hidden
         End If
         If SLIDERA.Value = 1 Then
             imageOFF.Visibility = Visibility.Hidden
             imageON.Visibility = Visibility.Visible
         End If
     End Sub
  </code></pre>
  
  <p>if I do this the form will not even launch</p>
  
  <ol start="2">
  <li>xaml using datatriger</li>
  </ol>
  
  <pre><code>
  &lt;Window.Resources&gt;
   &lt;Style x:Key ="imageONstyle" TargetType="Image"&gt;
             &lt;Setter Property="Visibility" Value="Hidden"/&gt;
              &lt;Style.Triggers&gt;
  
              &lt;DataTrigger Binding="{Binding ElementName=SILDERA, Path=Value}" Value="1"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  
          &lt;Style x:Key ="imageOffstyle" TargetType="Image"&gt;
             &lt;Setter Property="Visibility" Value="Hidden"/&gt;
              &lt;Style.Triggers&gt;
  
                  &lt;DataTrigger Binding="{Binding ElementName=SILDERA, Path=Value}" Value="0"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                  &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
  
  
  &lt;/Window.Resources&gt;
  
   &lt;Slider x:Name="SLIDERA"   Minimum="0" Maximum="1" Value="0.5" Margin="191,286,67,403" TickFrequency="0.5" IsSnapToTickEnabled="True"  SmallChange="0.5" LargeChange="0.5" Width="50" Height="16" ValueChanged="SLIDERA_ValueChanged"/&gt;
  
  
          &lt;Image  x:Name="imageON" Style="{StaticResource imageONstyle}" HorizontalAlignment="Left" Height="31" Margin="241,278,0,0" VerticalAlignment="Top" Width="21" Source="ButtonResources/LIGHTBULBON.png"/&gt;
  
          &lt;Image  x:Name="imageOFF" Style="{StaticResource imageOffstyle}" HorizontalAlignment="Left" Height="27" Margin="174,283,0,0" VerticalAlignment="Top" Width="16" Source="ButtonResources/LIGHTBULBOFF.png" /&gt;
  </code></pre>
  
  <p>but does nothing</p>
  
  <ol start="3">
  <li>Is using a converter no luck either </li>
  </ol>