private void AnimateItemsOutAndIn( List <string> groups, List <bool> groupsExpandable, Dictionary <string, List <string> > groupToChildren, int outStartIndex, int outItemCount, int inGroupIndex, int inItemCount) { m_list.UpdateLayout(); var itemsToAnimate = GetListBoxItemsInRange(outStartIndex, outItemCount); var parentGroupIndex = outStartIndex - 1; if (parentGroupIndex >= 0 && parentGroupIndex < m_children.Count) { m_children[parentGroupIndex].IsExpanded = false; } if (itemsToAnimate.Any()) { var menuDelayedSourceUpdateAnimatorListener = new MenuDelayedSourceUpdateAnimatorListener(groups, groupsExpandable, groupToChildren, this, inGroupIndex, inItemCount); var controls = ChildStackPanelsFor(itemsToAnimate); m_slideOutStoryboardRunner.AllCompleted += menuDelayedSourceUpdateAnimatorListener.OnCompleted; m_slideOutStoryboardRunner.Begin(itemsToAnimate); m_itemShutterCloseStoryboardRunner.Begin(controls); } }
private void AnimateItemsOut( List <string> groups, List <bool> groupsExpandable, Dictionary <string, List <string> > groupToChildren, int startIndex, int itemCount) { m_list.UpdateLayout(); var itemsToAnimate = GetListBoxItemsInRange(startIndex, itemCount); var parentGroupIndex = startIndex - 1; //animate out header for current group if (parentGroupIndex >= 0 && parentGroupIndex < m_children.Count) { m_children[parentGroupIndex].IsExpanded = false; } if (itemsToAnimate.Any()) { var menuDelayedSourceUpdateAnimatorListener = new MenuDelayedSourceUpdateAnimatorListener(groups, groupsExpandable, groupToChildren, this); var controls = ChildStackPanelsFor(itemsToAnimate); m_slideOutStoryboardRunner.AllCompleted += menuDelayedSourceUpdateAnimatorListener.OnCompleted; m_slideOutStoryboardRunner.Begin(itemsToAnimate.Where(_x => _x != null).ToList()); if (!m_itemShutterCloseStoryboardRunner.IsAnimating) { m_itemShutterCloseStoryboardRunner.AllCompleted += ItemShutterCloseCompleted; m_itemShutterCloseStoryboardRunner.Begin(controls); } } }