Implement INotifyPropertyChanged
properly, create properties for every TextBox/Field/ComboBox and bind them TwoWay. Make sure the changes made in your GUI are successfully reflected to your ViewModel. That being said, you are able to control the data that the user of your application has put in.
You will need to place an ObservableCollection
in your ViewModel bound to your DataGrid's ItemsSource
in order to notify the View about the changes. In your AddVlans()
function, simply add a new entry to this ObservableCollection
by using the associated property and you are done. If you implemented INotifyPropertyChanged
properly, the View should get notified about your added entry and therefore the entry would show up in your DataGrid.
If you don't know yet what I'm talking about, please consider reading about Binding in WPF first before continuing.