title: Binding objects defined in code-behind
body: <p>I have some object that is instantiated in code behind, for instance, the XAML is called window.xaml and within the window.xaml.cs</p>
  
  <pre><code>protected Dictionary&lt;string, myClass&gt; myDictionary;
  </code></pre>
  
  <p>How can I bind this object to, for example, a list view, using only XAML markups?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>(This is exactly I have in my test code):</p>
  
  <pre><code>&lt;Window x:Class="QuizBee.Host.Window1"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="{Binding windowname}" Height="300" Width="300"
      DataContext="{Binding RelativeSource={RelativeSource Self}}"&gt;
      &lt;Grid&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>And in codebehind</p>
  
  <pre><code>public partial class Window1 : Window
  {
      public const string windowname = "ABCDEFG";
  
      public Window1()
      {
          InitializeComponent();
      }
  }
  </code></pre>
  
  <p>Suppose the title should become "ABCDEFG" right? but it ends up showing nothing.</p>