title: How can I make a XAML Slider element snap to allowed values only?
body: <p>I have a slider with minimum value <strong>0</strong> and maximum value <strong>1</strong>.</p>
  
  <p>When I currently slide it, the value gets set to a decimal value between 0 and 1, e.g. <strong>0.2342343</strong>.</p>
  
  <p>However, I want the value to only be <strong>either 0 or 1</strong> (so that my ViewModel property will register the change only if it is 0 or 1 and not multiple times as the user drags it from 0 to 1).</p>
  
  <p><strong>How can I make the slider value only be 0 or 1?</strong> I tried SmallChange, LargeChange and SnapsToDevicePixels, but none of these work.</p>
  
  <pre><code>&lt;Slider Name="TheLanguageIndexSlider"
          DockPanel.Dock="Bottom" 
          Minimum="0" 
          Maximum="1" 
          LargeChange="1"
          SmallChange="1"
          SnapsToDevicePixels="True"
          Width="100" 
          Margin="5" 
          Value="{Binding LanguageIndex}"
          HorizontalAlignment="Left"/&gt;
  </code></pre>