Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FluidMoveBehavior triggering on Back navigation

I am working on a windows phone 7 application that uses the FluidMoveBehavior in some of my ListBoxes. For some reason, the FluidMoveBehavior animation seems to want to activate at inappropriate times. I currently have a ListBox on my main page, and I use the following ItemsPanelTemplate which is just a basic StackPanel with a FluidMoveBehavior attached to it:

<ItemsPanelTemplate x:Key="fancyListBoxItemsPanelTemplate"> 
    <StackPanel> 
        <Custom:Interaction.Behaviors> 
            <il:FluidMoveBehavior AppliesTo="Children"> 
                <il:FluidMoveBehavior.EaseX> 
                    <ExponentialEase EasingMode="EaseInOut"/> 
                </il:FluidMoveBehavior.EaseX> 
                <il:FluidMoveBehavior.EaseY> 
                    <ExponentialEase EasingMode="EaseInOut"/> 
                </il:FluidMoveBehavior.EaseY> 
            </il:FluidMoveBehavior> 
        </Custom:Interaction.Behaviors> 
    </StackPanel> 
</ItemsPanelTemplate> 

This works fine when I add/remove items while on the same screen. The animation plays perfectly. However, when I navigate to a new page from my main page, then navigate back, the fluid move animation is triggered as if all of the items were added at once. Is there any way to disable this behavior so it only triggers the animation when the list actually changes?

like image 645
Jeremy Bell Avatar asked Nov 14 '22 04:11

Jeremy Bell


1 Answers

this is happening because as you navigate to the page with the list box, the list box is created again, which is similar to adding all the items at once which in tuns fires the fluid move trigger. One possible (may not be the legitimate) solution is to have two identical ItemPanel template, one with the behavior and the other without it. When you first navigate to the page apply the template w/o the behavior. Later replace it with the one with the behavior. Hope that helps.

like image 123
Amresh Kumar Avatar answered Dec 24 '22 12:12

Amresh Kumar