How does the WP7 Pivot control dynamically load pivot items?

Posted by mztan on Stack Overflow See other posts from Stack Overflow or by mztan
Published on 2012-10-28T04:56:51Z Indexed on 2012/10/28 5:00 UTC
Read the original article Hit count: 141

Filed under:
|
|

IIRC, the Pivot control only loads a child PivotItem if it is the currently shown child. I would then guess that the previously seen child is also somehow unloaded, presumably still stored in memory, but hidden from the UI.

What I'm wondering is, how does the Pivot control dynamically load/unload a child control, and can that behavior be imitated within a custom UserControl? As for unloading, is it as simple as collapsing the previous child's visibility, or is something trickier going on?

That is to say, supposing I use my own UserControl like:

 <my:CustomUserControl>
   <TextBlock x:Name="_textBlock" Text="wait for it ..." />
 </my:CustomUserControl>

Normally, the child TextBlock is instantiated when the surrounding PhoneApplicationPage is instantiated, via InitializeComponent and all that. Is there any way to postpone this behavior and load the child programmatically?

© Stack Overflow or respective owner

Related posts about c#

Related posts about Silverlight