1
votes

I need to create dynamic TabControl in XAML depends on localizations. Have culture table in dataBase.

<TabControl Style="{DynamicResource StandardTabControlStyle}" ItemsSource="{Binding ItemsForTranslation}" x:Name="MainPanel">

In View Model:

#region Properties
    public ObservableCollection<Dictionary<Culture, ObservableCollection<TranslationItem>>> TranslationItemsSource { get; set; }
    #endregion

Tab item count == Culture count

Every TabItem must have collection of item's depends on ObservableCollection.count

And the main focus is to bind collection of objects from main viewModel of page to TabControl and every textbox for example from TabItem's to properties in mainViewModel.

Another example.

I have collection of objects with two properties: name and text. Let's say 5 objects.

My tab control must get 5 localizations from DB. Create 5 tab items and apply two way binding for every object in my collection to 1 label and 1 textbox for name and text properties.

Any ideas?

1

1 Answers

0
votes

Make DataTemplate with DataType = {x:Type Culture}, and put there ItemsControl. Its ItemTemplate another DataTemplate:

grid

columndef *

columndef *

textbox

textbox

Hope it helps..