This is a question of curiosity, I have no practical use for such expensive layouts.
I have the following Xaml
<Window x:Class="WpfApplication16.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen">
<TabControl ItemsSource="{Binding Items}">
<TabControl.ContentTemplate>
<DataTemplate>
<ScrollViewer>
<ContentPresenter Content="{Binding View}" />
</ScrollViewer>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</Window>
and the following code behind
public class Item
{
public FrameworkElement View { get { return m_view; } }
public Item()
{
for (int i = 0; i < 3000; ++i)
{
m_view.Items.Add(new TextBox());
}
}
ItemsControl m_view = new ItemsControl();
}
public partial class MainWindow : Window
{
public List<Item> Items { get; private set; }
public MainWindow()
{
Items = new List<Item>();
for (int i = 0; i < 10; ++i)
{
Items.Add(new Item());
}
DataContext = this;
InitializeComponent();
}
}
So before the window is initialized all the TextBoxes have already been constructed, all 30,000 of them, but they haven't been loaded yet. They only get loaded/unloaded when the selection is changed, such as when the initial selection takes place. I would expect changing tab the first time for each item to take a while due to the sheer amount of textboxes, but why is it that after Ive selected each tab, going through them again still takes a long time between load/unload?
There is no binding going on, and I don't think its a layout issue as when I resize the window it updates a lot faster than it does between changing tab. I don't think its a memory issue either (stuff having to be loaded in and out) as the memory usage grows between selecting tabs and then stays constant after all 10 have been selected, and run through again.
Also I'm purposely not using visualization.