Why do these tabs seem to share the same textbox?
<p>I defined my UI in xaml and below is my code:</p>

<pre><code>&lt;TabControl HorizontalAlignment="Left" Height="330" VerticalAlignment="Top" Width="764" Margin="10,10,0,0" ItemsSource="{Binding AllTabs}" SelectedItem="{Binding SelectedTab}"&gt;
        &lt;TabControl.ItemContainerStyle&gt;
            &lt;Style TargetType="TabItem"&gt;
                &lt;Setter Property="Header" Value="{Binding Header}"/&gt;
                &lt;Setter Property="Content"&gt;
                    &lt;Setter.Value&gt;
                        &lt;Grid&gt;
                            &lt;TextBox Text="{Binding Text}" FontSize="16" AcceptsReturn="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"&gt;
                            &lt;/TextBox&gt;
                        &lt;/Grid&gt;
                    &lt;/Setter.Value&gt;
                &lt;/Setter&gt;
                &lt;Setter Property="FontSize" Value="20"/&gt;
            &lt;/Style&gt;
        &lt;/TabControl.ItemContainerStyle&gt;
    &lt;/TabControl&gt;
</code></pre>

<p>When I ran my program. I could add many tabs with no problem. The headers are different but whenever I change the content of textbox in one of tabs, all the textboxes in other tabs changed to the same content (Seems like they were all sharing the same textbox, or binding to the same source, which is wierd). </p>

<p>Did I make a mistake defining the UI? Please help me and thanks in advance.</p>

<p>This is my model, really simple:</p>

<pre><code>using System;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace MyHomework__MVVM_
{
    class MyHomeworkModel : INotifyPropertyChanged
    {
        private string header, text;
        public event PropertyChangedEventHandler PropertyChanged;

        public string Header
        {
            get
            {
                return header;
            }
            set
            {
                header = value;
                OnPropertyChanged("Header");
            }
        }

        public string Text
        {
            get
            {
                return text;
            }
            set
            {
                text = value;
                OnPropertyChanged("Text");
            }
        }

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
</code></pre>

<p>And my viewmodel, which is still really simple:</p>

<pre><code>using MyHomework;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Input;

namespace MyHomework__MVVM_
{
    class MyHomeworkViewModel : INotifyPropertyChanged
    {
        private ObservableCollection&lt;MyHomeworkModel&gt; allTabs;
        private MyHomeworkModel selectedTab;
        public event PropertyChangedEventHandler PropertyChanged;

        public MyHomeworkViewModel()
        {
            allTabs = new ObservableCollection&lt;MyHomeworkModel&gt;();
            selectedTab = new MyHomeworkModel();
            AddCourseCommand = new AddCourseCommand(this);
        }

        public ObservableCollection&lt;MyHomeworkModel&gt; AllTabs
        {
            get
            {
                return allTabs;
            }
            set
            {
                allTabs = value;
                OnPropertyChanged("AllTabs");
            }
        }

        public MyHomeworkModel SelectedTab
        {
            get
            {
                return selectedTab;
            }
            set
            {
                selectedTab = value;
                OnPropertyChanged("SelectedTab");
            }
        }

        public ICommand AddCourseCommand
        {
            get;
            private set;
        }

        public void AddNewTab()
        {
            NewCourseName ncn = new NewCourseName();
            ncn.ShowDialog();
            if (ncn.courseName != null)
            {
                MyHomeworkModel newTab = new MyHomeworkModel();
                newTab.Header = ncn.courseName;
                newTab.Text = ncn.courseName;
                AllTabs.Add(newTab);
                SelectedTab = newTab;
            }
        }

        private void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
</code></pre>

<p>EDIT:
Just noticed that I got this message:</p>

<pre><code>System.Windows.Data Error: 40 : BindingExpression path error: 'Text' property not found on 'object' ''MyHomeworkViewModel' (HashCode=31265986)'. BindingExpression:Path=Text; DataItem='MyHomeworkViewModel' (HashCode=31265986); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')
</code></pre>

<p>I think I know why it's complaining. My Text property is is MyHomeworkModel not MyHomeworkViewModel...but why it's fine with me binding the header to the Header property in MyHomeworkModel ?</p>

<p>My AddCourseCommand class:</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace MyHomework__MVVM_
{
    class AddCourseCommand : ICommand
    {
        private MyHomeworkViewModel viewModel;

        public AddCourseCommand(MyHomeworkViewModel viewModel)
        {
            this.viewModel = viewModel;
        }

        public event EventHandler CanExecuteChanged
        {
            add
            {
                CommandManager.RequerySuggested += value;
            }
            remove
            {
                CommandManager.RequerySuggested -= value;
            }
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public void Execute(object parameter)
        {
            viewModel.AddNewTab();
        }
    }
}
</code></pre>
