Dynamic Tab Control in WPF MVVM

Dynamic tab control in WPF using MVVM pattern is pretty much simple.
For example

<TabControl Name="tabDynamic" ItemsSource="{Binding CurrencyList}" SelectionChanged="SelectedCurrency">   
         <TextBlock Text={Binding CurrenyName}>


   ObservableCollection<CurrencyDTO> _currencyList;
   public ObservableCollection<CurrencyDTO> CurrencyList
      return _currencyList;
   CurrencyDTO _selectedCurrency;
   public CurrencyDTO SelectedCurrency
      return _selectedCurrency;

You can fill CurrencyList Collection by making server call. If you get 3 currency in this you will get 3 tab in your xaml at runtime.
On selection on any tab you control goes to SelectedCurrency this property now you can apply your logics inside this property.
CurrenyName is property which you made in your CurrencyDTO. We bind this property to show text in Tab. I want to show CurencyName that why i bind currencyname. You can bind any property which is  in your CurrencyDTO.
Please feel free to ask any question folks.

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now