title: How to pass a variable as Converterparameter in WPF
body: <p>I'm trying to pass a variable defined in the code behind as <code>ConverterParameter</code>. I'll use this parameter in the converter then to decide on some unit conversion. The problem is I don't know how to pass this. The variable is not static.</p>
  
  <pre><code>&lt;TextBox Text="{Binding MinimumRebarsVerticalDistance, Converter={StaticResource LengthConverter}, ConverterParameter={CurrentDisplayUnit}}"/&gt;
  </code></pre>
  
  <p><strong>Code behind:</strong></p>
  
  <pre><code>private Units currentDisplayUnit;
  public Units CurrentDisplayUnit
  {
      get { return currentDisplayUnit; }
      set
      {
          currentDisplayUnit = value;
          RaisePropertyChanged("CurrentDisplayUnit");
      }
  }
  </code></pre>