Disable pivot transition temporarily

Topics: Extensibility, Framework Services
Jan 20, 2012 at 3:40 AM

Working on a WP7.1 app similar to the PivotPage, TabItem example.

My tab items are effectively frames in a sequence. So i can slide back and forth, transition nicely between them with gestures.

However I would like to have the option to play all frames (maximum 8) in sequence. I can use a dispatch timer (should I be using a coroutine?) that will call ActivateItem on each tab after 0.5 second. It works but each frame will then fly in from the right (transition in).

When playing the sequence I would like to be able to disable the transition so that each frame just appears in place on the screen. 

Thanks,

Lachie

Coordinator
Jan 20, 2012 at 1:48 PM

I would recommend perhaps overlaying the Pivot with a ContentControl when you want to show a sequence, bound to the same ActiveItem property. You can control it's visibility with binding too. Also, you could use a coroutine within a loop to wait then change active item. Sudo code:

ShowingSequence = true; //shows the content control

foreach(var item in Items){

    ActivateItem(item);

    yield return new WaitMilliseconds(500);

}

Jan 31, 2012 at 11:57 PM
Edited Feb 1, 2012 at 12:05 AM

Thanks Rob.

I attempted to do what you have said. Im not sure if my co-routine is working correctly yet but Im having more problems with the content control and pivot control showing/collapsing correctly.

It sort of works but not really. The first Item in the PivotControl shows up correctly but then when you pivot to the next or any of the other 'tabs' they wont show (just the header only). If you switch to edit mode the contentcontrol will show the correct content but only if the pivotcontrol isnt showing anything. Also the content control seems to be constrained to only a small portion of the screen?

If I comment out the contentcontrol then the PivotControl works fine.
Im guessing Im not binding to the ActiveItem property the correct way? If I try to bind the content of the contentControl then I only get text showing up (class name I think).

In my sequence view

<Controls:Pivot           
        x:Name="Items"
        Visibility="{Binding PlayEditModeInverse}"
	Grid.Row="1"
        />
<ContentControl 
        x:Name="ActiveItem"
        Visibility="{Binding PlayEditMode}"
        Grid.Row="1"
        />

 

Coordinator
Feb 1, 2012 at 3:12 PM

Actually, I think I gave you some bad advice. I believe the problem is that a view can only be in one place at a time. So, it can't be in both the pivot and the content control. You might need to find some other strategy for this scenario.

Coordinator
Feb 1, 2012 at 3:12 PM

If you are inheriting from Screen for any of your items....try turning the view caching off. That might solve it.