.NET/C# MVVM RelayCommand with Parameters

I am using the MVVM Light Toolkit here to implement a RelayCommand with parameters. In this example, the command adds a value (entered by the user) to a number (held in the view model). A TextBox is used to enter the value. I did not like the idea of binding its value to a property in the view model as it does not seem to be part of the view model’s state.

private ICommand _addNumberCommand;
public ICommand AddNumberCommand
    if (_addNumberCommand == null)
      _addNumberCommand = new RelayCommand<int>(i => AddNumber(i));
    return _addNumberCommand;
public void AddNumber(int n)
  Number += n;

Here is the view’s XAML code:

<TextBox Name="InputNumber"/>
<Button Command="{Binding AddNumberCommand}" 
  CommandParameter="{Binding ElementName=InputNumber, Path=Text, Converter={StaticResource Converter}}">

A converter is needed to convert the TextBox’s string into int:

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  int i = 0;
  string s = value as string;
  if (s != null)
    int.TryParse(s, out i);
  return i;
  <local:StringToIntConverter x:Key="Converter"/>

Download source code of example.