This question is locked. New answers and comments are not allowed.
Hi!
I'm playing with TabControlHeadTemplate example from this forum.
But instead of oversimplified:
I re-factored it to more realistic:
Now, every time I switch tabs, TabControl recreates my usercontrols (hits constructor's breakpoint).
Is that how it supposed to work? Is there any way to re-use in-memory views?
My concern is that for complex usercontrols it can take a long time to re-bind UI to a ViewModel.
Thank you,
Maxim
I'm playing with TabControlHeadTemplate example from this forum.
But instead of oversimplified:
<DataTemplate x:Key="ContentTemplateAlpha"> <Rectangle Fill="Aqua" Width="200" Height="200" /> </DataTemplate> <DataTemplate x:Key="ContentTemplateBetta"> <Rectangle Fill="Red" Width="200" Height="200" /> </DataTemplate>
I re-factored it to more realistic:
<DataTemplate x:Key="ContentTemplateAlpha"> <local:UserControlAqua/> </DataTemplate> <DataTemplate x:Key="ContentTemplateBetta"> <local:UserControlRed/> </DataTemplate>
Now, every time I switch tabs, TabControl recreates my usercontrols (hits constructor's breakpoint).
Is that how it supposed to work? Is there any way to re-use in-memory views?
My concern is that for complex usercontrols it can take a long time to re-bind UI to a ViewModel.
Thank you,
Maxim