title: TextBox Binding inside WPF ListView ItemTemplate
body: <p>I am trying to bind a textbox inside itemtemplate of my listview. As itemssource, I am using ObservableCollection. I have tried binding itemtemplate to datacontext itself by {Binding},yet it gives me InvalidOperationException. Here is the related snippet</p>
  
  <pre><code>&lt;ListView Name="listOrder" ItemsSource="{Binding OrderBys,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Stretch"&gt;
                              &lt;ListView.ContextMenu&gt;
                                  &lt;ContextMenu&gt;
                                      &lt;MenuItem Name="AddOrder" Header="Sıra Ekle" Click="AddOrder_Click" /&gt;
                                  &lt;/ContextMenu&gt;
                              &lt;/ListView.ContextMenu&gt;
                              &lt;ListView.ItemTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;TextBox FontSize="10" Text="{Binding}"&gt;&lt;/TextBox&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/ListView.ItemTemplate&gt;
                          &lt;/ListView&gt;
  </code></pre>
  
  <p>Here is the related part from the ViewModel</p>
  
  <pre><code>public class ViewModel_ReportDesigner : ViewModelBase
  {
  
      //Tables
      public List&lt;string&gt; Tables
      {
          get
          {
              Reporting.ReportUtils rr = new Reporting.ReportUtils();
              return rr.GetChildList("IGAEntities");
          }
      }
  
      private string _selectedTable;
      public string SelectedTable {
          get
          {
              return _selectedTable;
          }
          set
          {
              _selectedTable = value;
              RaisePropertyChangedEvent("SelectedTable");
              RaisePropertyChangedEvent("Fields");
  
          }
      }
  
      //Fields
      public ObservableCollection&lt;string&gt; Fields
      {
          get
          {
              Reporting.ReportUtils rr = new Reporting.ReportUtils();
              if (SelectedTable != null)
              {
                  return new ObservableCollection&lt;string&gt;(rr.GetChildList(SelectedTable));
              }
              return null;
          }
      }
  
  
      //Number of Fields
      private int _NumberOfFields;
      public int NumberOfFields
      {
          get
          {
              return _NumberOfFields;
          }
          set
          {
              _NumberOfFields = value;
              RaisePropertyChangedEvent("NumberOfFields");
          }
      }
  
      public ObservableCollection&lt;ReportField&gt; getEmptyFieldList()
      {
          ObservableCollection&lt;ReportField&gt; list = new ObservableCollection&lt;ReportField&gt;();
          for (int i = 1; i &lt;= _NumberOfFields; i++)
          {
              list.Add(new ReportField("''", i.ToString()));
          }
          return list;
      }
  
      //Groups
      private List&lt;string&gt; _Groups;
      public List&lt;string&gt; Groups
      {
          get
          {
              if (_Groups == null)
              {
                  _Groups = new List&lt;string&gt;();
              }
              return _Groups;
          }set
          {
              _Groups = value;
              RaisePropertyChangedEvent("Groups");
          }
      }
      //TableCreators
      private ObservableCollection&lt;TableCreator&gt; _TableCreators;
      public ObservableCollection&lt;TableCreator&gt; TableCreators
      {
          get
          {
              if (_TableCreators == null)
                  _TableCreators = new ObservableCollection&lt;TableCreator&gt;();  
              return _TableCreators;
          }
          set
          {
              _TableCreators = value;
              RaisePropertyChangedEvent("TableCreators");
          }
      }
  
      private TableCreator _SelectedTableCreator;
      public TableCreator SelectedTableCreator
      {
          get
          {
              return _SelectedTableCreator;
          }
          set
          {
              _SelectedTableCreator = value;
              RaisePropertyChangedEvent("SelectedTableCreator");
          }
      }
  
      internal void RaiseChanged(string v)
      {
          RaisePropertyChangedEvent(v);
      }
  }
  </code></pre>
  
  <p>Actually listview i am talking about is inside another listview. To make it all clear. When i add item to parent listview, I create an empty List and bind it to child listview. Then from context menu i add related elements like this</p>
  
  <pre><code>vm.SelectedTableCreator.OrderBys.Add("");
          vm.RaiseChanged("TableCreators");
  </code></pre>
  
  <p><strong>Edit:</strong>
  Now i realized that my binding is correct, only problem is that textbox change event will not fire after i change the text inside the textbox. </p>