title: Get Listbox SelectedValue in MVVM
body: <p>I have a MainWindow that contains A listbox, and a ContentControl, each time you select something from the Listbox, the ContentControl will display something else.</p>
  
  <pre><code>   &lt;ContentControl Content="{Binding ElementName=SomeList, Path=SelectedItem.Content}" /&gt;
  
    &lt;ListBox  x:Name="SomeList" Margin="0 16 0 16" SelectedIndex="0"  SelectedValue="{Binding X}"            
                           ItemsSource="{Binding DemoItems}"&gt;
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code> private string _X;
      public string X
  
      {
          get { return _X; }
          set
          {
              _X = value;
              NotifyOfPropertyChange("X");
          }
      }
  </code></pre>
  
  <p>Trying to display X will result in the same thing: </p>
  
  <blockquote>
    <p>namespace.DemoItem</p>
  </blockquote>
  
  <p>DemoItem.cs:</p>
  
  <pre><code> public class DemoItem : INotifyPropertyChanged
  {
      private object _icon;
      private string _name;
      private object _content;
      private Thickness _marginRequirement;
  
      public DemoItem(object icon, string name, object content, Thickness margin,  IEnumerable&lt;DocumentationLink&gt; documentation)
      {
          _icon = icon;
          _name = name;
          Content = content;
          _marginRequirement = margin;
  
          Documentation = documentation;
      }
  } 
  </code></pre>
  
  <p>So how is it possible to only get the name?</p>