title: WPF CommandParameter MultiBinding values null
body: <p>I am simply trying to bind two controls as command parameters and pass them into my command as an <code>object[]</code>.</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
          &lt;C:MultiValueConverter x:Key="MultiParamConverter"&gt;&lt;/C:MultiValueConverter&gt;
      &lt;/UserControl.Resources&gt;
  
      &lt;StackPanel Orientation="Vertical"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;Button Name="Expander" Content="+" Width="25" Margin="4,0,4,0" Command="{Binding ExpanderCommand}"&gt;
                  &lt;Button.CommandParameter&gt;
                      &lt;MultiBinding Converter="{StaticResource MultiParamConverter}"&gt;
                          &lt;Binding ElementName="Content"/&gt;
                          &lt;Binding ElementName="Expander"/&gt;
                      &lt;/MultiBinding&gt;
                  &lt;/Button.CommandParameter&gt;
              &lt;/Button&gt;
              &lt;Label FontWeight="Bold"&gt;GENERAL INFORMATION&lt;/Label&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel Name="Content" Orientation="Vertical" Visibility="Collapsed"&gt;
              &lt;Label&gt;Test&lt;/Label&gt;
          &lt;/StackPanel&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Command:</p>
  
  <pre><code>public ICommand ExpanderCommand
          {
              get
              {
                  return new RelayCommand(delegate(object param)
                      {
                          var args = (object[])param;
                          var content = (UIElement)args[0];
                          var button = (Button)args[1];
                          content.Visibility = (content.Visibility == Visibility.Visible) ? Visibility.Collapsed : Visibility.Visible;
                          button.Content = (content.Visibility == Visibility.Visible) ? "-" : "+";
                      });
              }
          }
  </code></pre>
  
  <p>Converter:</p>
  
  <pre><code>public class MultiValueConverter : IMultiValueConverter
      {
          public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
          {
              return values;
          }
  
          public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
          {
              throw new NotImplementedException("No two way conversion, one way binding only.");
          }
      }
  </code></pre>
  
  <p>Basically what is happening is that the binding seems to be working fine and the converter is returning an <code>object[]</code> containing the correct values, however when the command executes the param is an <code>object[]</code> containing the same number of elements except they are <code>null</code>.</p>
  
  <p>Can someone please tell me why the values of the <code>object[]</code> parameter are being set to <code>null</code>?</p>
  
  <p>Thanks,
  Alex.</p>