title: XAML bound property isn't working as expected
body: <p>I have a Crew property, the property has several fields, few of which are Code and InvoiceAmount. The plus button is supposed to insert a new crew into an ObservableCollection of crews. Adding the first item works fine, however when the second item is inserted the first item's code changes to the second item and the second item has no visible code. How do I fix it so that a new crew is inserted every time I click the + button?</p>
  
  <p>Starting UI:</p>
  
  <p><a href="https://i.stack.imgur.com/VBgte.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VBgte.png" alt="enter image description here"></a></p>
  
  <p>After one item (a) has been added:</p>
  
  <p><a href="https://i.stack.imgur.com/8rG9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8rG9L.png" alt="enter image description here"></a></p>
  
  <p>Second item (b) has been added:</p>
  
  <p><a href="https://i.stack.imgur.com/5F0iY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5F0iY.png" alt="enter image description here"></a></p>
  
  <p>Here's the ViewModel code:</p>
  
  <pre><code>public class MainPageViewModel : ViewModelBase
  {
      public MainPageViewModel()
      {
          AddCrewCommand = new CustomCommand(param =&gt; addCrew(), null);
          Crews.CollectionChanged += new NotifyCollectionChangedEventHandler(Crews_Updated);
      }
  
      private void Crews_Updated(object sender, NotifyCollectionChangedEventArgs e)
      {
          RaisePropertyChanged("lvCrewList");
      }
  
      public Crew Crew { get; set; } = new Crew();
  
      public ObservableCollection&lt;Crew&gt; Crews { get; private set; } = new ObservableCollection&lt;Crew&gt;();
  
      public Crew SelectedCrew { get; set; }
  
      public ICommand AddCrewCommand { get; private set; }
  
      private void addCrew()
      {
          Crews.Add(Crew);
          Crew = new Crew();
      }
  
      public ObservableCollection&lt;string&gt; SelectedWorkOrder { get; set; }
  }
  </code></pre>
  
  <p>ViewModelBase:</p>
  
  <pre><code>public class ViewModelBase : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
      protected void RaisePropertyChanged(string propertyName)
      {
          PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
      }
  }
  </code></pre>
  
  <p>Here's the XAML bit that assigns the Code field:</p>
  
  <pre><code>        &lt;StackPanel Orientation="Horizontal" VerticalAlignment="Top" &gt;
              &lt;Label Content="Crew" Width="55" Height="25" Margin="10,10,0,0"/&gt;
              &lt;TextBox x:Name="txtCrew" Width="75" Height="25" Margin="0,10,10,0"
                  Text="{Binding Crew.Code, Mode=TwoWay}" /&gt;
              &lt;Button Content="+" Width="25" Height="25" Margin="0, 10, 0, 0" Command="{Binding AddCrewCommand}" /&gt;
          &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Crew Class:</p>
  
  <pre><code>public class Crew
  {
      public string Code { get; set; }
  
      public decimal InvoiceAmount { get; set; } = 0;
  
      public Job Job { get; set; }
  
      public override string ToString() =&gt; Code;
  }
  </code></pre>