Adding tab items dynamically in WPF / MVVM
Some instructions on how to add/remove tab items within a WPF / MVVM setting. Step 1: Create a new WPF application Step 2: Add classes to implement ICommand RelayCommand.cs [code language="csharp"] using System; using System.Windows.Input; namespace Tabs { public class RelayCommand<T> : ICommand { private readonly Predicate<T> _canExecute; private readonly Action<T> _execute; public RelayCommand(Action<T> execute) : this(execute, null) { _execute = execute; } public RelayCommand(Action<T> execute, Predicate<T> canExecute) { if (execute == null) { throw new ArgumentNullException("execute"); } _execute = execute; _canExecute = canExecute; } public bool CanExecute(object parameter) { return _canExecute == null || _canExecute((T)parameter); } public vo...