I am using a WPF user control (tab control) to add tab items dynamically in the simplified code below:
....
foreach (string id in ids)
{
TabControl.Items.Add(CreateTabItem(id));
}
private TabItem CreateTabItem(string name)
{
StackPanel txtBlock = new TextBlock();
txtblock.Text = name;
txtBlock.HorizontalAlignment = Horizontalalignment.Center;
panel.Children.Add(txtBlock);
TabItem item = new TabItem();
item.Header = panel;
<SomeControl> control = new <SomeControl>();
item.Content = control;
return item;
}
In the xaml file I specified the following to stack all my tab items to the left column:
MinWidth="100" MinHeight="300" TabStripPlacement="Left"
How do I make my tab control automatically extending (ie. stretching) its height to show all the tab items as I add them in? For now, I have to manually extend the height of the display window to see all the tab items. Your insights/tips are greatly appreciated.
PS: if you know how to make the vertical scroll bar appears (without adding scroll bar to my control) as soon as the tab items exceed the window height, I can settle for that if there are no answers for my original intent.