title: WPF bind a dynamic generated slider to function
body: <p><strong>First: Not a duplicate of <a href="https://stackoverflow.com/questions/3531772/binding-button-click-to-a-method">Binding Button click to a method</a> --- it's about button, and Relay command can't pass the arguments I need</strong></p>
  
  <p><strong>Also, not a duplicate of <a href="https://stackoverflow.com/questions/9130951/how-do-you-bind-a-button-command-to-a-member-method">How do you bind a Button Command to a member method?</a> - it's a simple method with no arguments - nothing to do with my question.</strong></p>
  
  <p><strong>Obviously (but just to make sure and avoid trolls) not a duplicate of this either <a href="https://stackoverflow.com/questions/4586777/silverlight-mvvm-where-did-my-object-sender-routedeventargs-e-go">Silverlight MVVM: where did my (object sender, RoutedEventArgs e) go?</a>.</strong></p>
  
  <p>Now after clearing this (sorry, I am just really sick of being marked as "duplicate" by people who didn't understand my question), <strong>let's talk about the issue:</strong> :D</p>
  
  <p>I am trying to bind a generated slider (using data template) to an event (value changed), I know it's impossible to bind an event and I must use ICommand, but I don't know how to get the event arguments to the command function, this is the xaml relevant code: (without the binding since it doesnt work)</p>
  
  <pre><code>&lt;Slider Grid.Column="1"  Grid.Row="1" Height="30" IsSnapToTickEnabled="True"  Maximum="100" SmallChange="1" IsMoveToPointEnabled="True"/&gt;
  </code></pre>
  
  <p>And this is the function I want it to be binded to:</p>
  
  <pre><code>public void vibrationSlider_move(object Sender, RoutedPropertyChangedEventArgs&lt;double&gt; e)
          {
              VibrationValue = (byte)e.NewValue;
              SendPacket(cockpitType, (byte)Index.VibrationSlider, VibrationValue);
          }
  </code></pre>
  
  <p>As you can see, I need to use the 'e' coming with the event, I have no idea how to reach it without using the "ValueChanged" slider event.</p>
  
  <p>Notes:</p>
  
  <p>Please don't tell me to add the "ValueChanged" attribute like this:</p>
  
  <pre><code>&lt;Slider ValueChanged="VibrationSlider_move"/&gt;
  </code></pre>
  
  <p>:)</p>
  
  <p>It's a generated dynamic slider using DataTemplate with an observableCollection, the function isn't in the window.cs file, therefore just using an event is not possible.</p>
  
  <p>Thank you.</p>