title: WPF Binding to multidimensional array in the xaml
body: <p>I have trouble to formulate the XAML string to link to a specific element in a multidimensional array.</p>
  
  <p>The DataContext contains the following lines:</p>
  
  <pre><code>    private String[] _OneDimension = { "[0]", "[1]" };
      private String[][] _Jagged = { new String[] { "[0,0]", "[0,1]" }, new String[] { "[1,0]", "[1,1]" } };
      private String[,] _TwoDimension = { { "[0,0]", "[0,1]" }, { "[1,0]", "[1,1]" } };
  
      public String[] OneDimension { get { return _OneDimension; } }
      public String[][] Jagged { get { return _Jagged; } }
      public String[,] TwoDimension { get { return _TwoDimension; } }
  </code></pre>
  
  <p>The XAML contains the following lines:</p>
  
  <pre><code>    &lt;StackPanel&gt;
          &lt;Button Content="{Binding OneDimension[1]}" Width="100" Height="50" /&gt;
          &lt;Button Content="{Binding Jagged[1][1]}" Width="100" Height="50" /&gt;
          &lt;Button Content="{Binding TwoDimension[1][1]}" Width="100" Height="50" /&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>The binding to <code>OneDimension</code> and <code>Jagged</code> work as expected. The binding to <code>TwoDimension</code> does not work and appears to be wrong, however the XAML does not allow me to use the separator <code>,</code> so I do not know how to bind to a two dimensional array.</p>
  
  <p>This:</p>
  
  <pre><code>        &lt;Button Content="{Binding TwoDimension[1,1]}" Width="100" Height="50" /&gt;
  </code></pre>
  
  <p>does not compile because the XAML gets interpreted as having two arguments for the Binding Constructor. Is there some way to escape the parser or is there another way of writing this that I am not aware of?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>I just found out that it is possible to escape the separator like this</p>
  
  <pre><code>&lt;Button Content="{Binding TwoDimension[1\,1]}" Width="100" Height="50" /&gt;
  </code></pre>
  
  <p>or just surround the argument with markers like this</p>
  
  <pre><code>&lt;Button Content="{Binding 'TwoDimension[1,1]'}" Width="100" Height="50" /&gt;
  </code></pre>
  
  <p>However this line now leads to an exception: <code>System.ArgumentException</code> {"Das Array war kein eindimensionales Array."} unfortunatelly C# installed itself in my native language - annoying as shit...  so this roughly translates to {"The Array was not a onedimensionale Array."}</p>
  
  <p>Is it actually impossible to bind multidimensional arrays?</p>