title: Unable to see my textbox data in Datagrid by clicking button using MVVM pattern?
body: <p><img src="https://i.stack.imgur.com/wyvpR.png" alt="enter image description here"></p>
  
  <p>Hi guys i have a problem since last week and i am unable to sort out the reason,the problem is i want my textboxes data to be display in a datagrid ,i am using WPF C# and pattern is MVVM.</p>
  
  <p>My code in XAML is:</p>
  
  <pre><code>    &lt;TextBox 
              Grid.Row="0"
              Grid.Column="1"
              Margin="0,5,0,0"
              Height="25"
              Foreground="Black"
              Opacity="0.8"
              Width="Auto"
              Text="{Binding VlanName, UpdateSourceTrigger=PropertyChanged}"  
              /&gt;
  
  
  
          &lt;TextBox 
              Grid.Row="1"
              Grid.Column="1"
              Margin="0,5,0,0"
              Height="25"
              Foreground="Black"
              Opacity="0.8"
              Width="70"
              HorizontalAlignment="Left"
              Text="{Binding VlanID, UpdateSourceTrigger=PropertyChanged}"   
              /&gt;
  
   &lt;Button Grid.Column="3"
              Grid.Row="1"
              Content="Add VLAN"
              Margin="10,5,0,0"
              Style="{StaticResource AppButtons}"
              Command="{Binding AddVlan}" 
  
              /&gt;      
  
      &lt;Button Grid.Column="3" 
              Grid.Row="2"
              Content="Remove VLAN"
              Margin="10,5,0,0"
              Style="{StaticResource AppButtons}"
              Width="100"
              Command="{Binding RemoveVlan}"
              /&gt;
  &lt;DataGrid Grid.Row="4"
                Grid.ColumnSpan="3"
                Height="200"
                Margin="10,10,0,0"
                Name="dg"
                ItemsSource="{Binding Source=vlan}"
                AutoGenerateColumns="False"
  
                &gt; 
  
        &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Header="S.No"    Binding="{Binding Path=S_No}"/&gt;
          &lt;DataGridTextColumn Header="VLAN Name" Binding="{Binding Path=vname}"   /&gt;
          &lt;DataGridTextColumn Header="VLAN ID"      Binding="{Binding Path=vid}" /&gt;
          &lt;DataGridTextColumn Header="           IP" Width="100"/&gt;
          &lt;DataGridTextColumn Header="VLAN Ports" Width="100"/&gt;
        &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  </code></pre>
  
  <p>C# View model is :</p>
  
  <pre><code> vlan = new ObservableCollection&lt;VLANSPropertyClass&gt;();
  
  
  
      public string VlanName
          {
            get
            {
              return this.ConfigurationLibrary.ConfigLibraryVlanName;
            }
            set
            {
              if (String.Equals(this.ConfigurationLibrary.ConfigLibraryVlanName, value))
              {
                return;
              }
              this.ConfigurationLibrary.ConfigLibraryVlanName = value;
              this.OnPropertyChanged("VlanName");
            }
          }
      public string VlanID
      {
        get
        {
          return this.ConfigurationLibrary.ConfigLibraryVlanName;
        }
        set
        {
          if (String.Equals(this.ConfigurationLibrary.ConfigLibraryVlanName, value))
          {
            return;
          }
          this.ConfigurationLibrary.ConfigLibraryVlanName = value;
          this.OnPropertyChanged("VlanID");
        }
      }
       public ICommand AddVlan
          {
            get
            {
              if (_addVlan == null)
                _addVlan = new RelayCommand(() =&gt; this.AddVlans());
  
              return _addVlan;
            }
  
          }
  
          public ICommand RemoveVlan
          {
            get
            {
              if (_removeVlan == null)
                _removeVlan = new RelayCommand(() =&gt; this.RemoveVlans());
  
              return _removeVlan;
            }
  
          }
          #endregion //ICommand region end
  
          void AddVlans()
          {
            Console.WriteLine("Add vlan");
            var serial = new VLANSPropertyClass();
            serial.S_No = vlan.Count + 1;
            serial.vname = VlanName;
            serial.vid = VlanID;
            vlan.Add(serial);
          }
  </code></pre>
  
  <p>Code in the VLAN method is not working i dont know why because i am able to see the line <code>Add vlan</code> which i wrote in Console but later code is not working i dont know the reason please help?</p>