title: Bind textbox to dictionary using a variable key
body: <p>I want to implement a dynamic UI where TextBox controls will be created dynamically, and their content bound to a Dictionary on the ViewModel.</p>
  
  <p>I'm trying to implement two-way data binding using ReactiveUI.</p>
  
  <p>The issue I'm facing is that I only seem to be allowed to bind the TextBoxes to an entry in the Dictionary if I use a literal string as the key, but as soon as I try to use a string variable to setup the binding, I get the following error:</p>
  
  <pre><code>Index expressions are only supported with constants.
  </code></pre>
  
  <p>Here is a very simplified sample of what I'm trying to do. The TextBox is not dynamically instantiated in order to isolate the problem:</p>
  
  <pre><code>string PropNum = "22017";
  this.Bind(ViewModel, vm =&gt; vm.ExcelData[PropNum], view =&gt; view.tbCreate.Text);
  </code></pre>
  
  <p>In this example, <code>ExcelData</code> is a <code>Dictionary&lt;string, object&gt;</code> defined on the ViewModel.</p>
  
  <p>On the other hand, the following works fine:</p>
  
  <pre><code>this.Bind(ViewModel, vm =&gt; vm.ExcelData["22017"], view =&gt; view.tbCreate.Text);
  </code></pre>
  
  <p>I need the lookup key to be a variable. Any ways to achieve this result?</p>
  
  <p>Thanks</p>