Ejemplo n.º 1
0
        void radioListGropus_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
        {
            e.Cancel = true;

            SwivelTransition       transition             = new SwivelTransition();
            ItemContainerGenerator itemContainerGenerator = e.ItemsControl.ItemContainerGenerator;

            int animationFinished = 0;
            int itemCount         = e.ItemsControl.Items.Count;

            for (int i = 0; i < itemCount; i++)
            {
                UIElement element = itemContainerGenerator.ContainerFromIndex(i) as UIElement;

                ITransition animation = transition.GetTransition(element);
                animation.Completed += delegate
                {
                    // close the group view when all animations have completed
                    if ((++animationFinished) == itemCount)
                    {
                        radioListGropus.CloseGroupView();
                        radioListGropus.ScrollToGroup(e.SelectedGroup);
                    }
                };
                animation.Begin();
            }
        }
Ejemplo n.º 2
0
        public static void GroupViewClose(this LongListSelector list, GroupViewClosingEventArgs e)
        {
            //Cancelling automatic closing and scrolling to do it manually.
            e.Cancel = true;
            if (e.SelectedGroup != null)
            {
                list.ScrollToGroup(e.SelectedGroup);
            }

            //Dispatch the swivel animation for performance on the UI thread.
            Application.Current.RootVisual.Dispatcher.BeginInvoke(() =>
            {
                //Construct and begin a swivel animation to pop out the group view.
                IEasingFunction quadraticEase = new QuadraticEase {
                    EasingMode = EasingMode.EaseOut
                };
                Storyboard _swivelHide  = new Storyboard();
                ItemsControl groupItems = e.ItemsControl;

                foreach (var item in groupItems.Items)
                {
                    UIElement container = groupItems.ItemContainerGenerator.ContainerFromItem(item) as UIElement;
                    if (container != null)
                    {
                        Border content = VisualTreeHelper.GetChild(container, 0) as Border;
                        if (content != null)
                        {
                            DoubleAnimationUsingKeyFrames showAnimation = new DoubleAnimationUsingKeyFrames();

                            EasingDoubleKeyFrame showKeyFrame1 = new EasingDoubleKeyFrame();
                            showKeyFrame1.KeyTime        = TimeSpan.FromMilliseconds(0);
                            showKeyFrame1.Value          = 0;
                            showKeyFrame1.EasingFunction = quadraticEase;

                            EasingDoubleKeyFrame showKeyFrame2 = new EasingDoubleKeyFrame();
                            showKeyFrame2.KeyTime        = TimeSpan.FromMilliseconds(125);
                            showKeyFrame2.Value          = 90;
                            showKeyFrame2.EasingFunction = quadraticEase;

                            showAnimation.KeyFrames.Add(showKeyFrame1);
                            showAnimation.KeyFrames.Add(showKeyFrame2);

                            Storyboard.SetTargetProperty(showAnimation, new PropertyPath(PlaneProjection.RotationXProperty));
                            Storyboard.SetTarget(showAnimation, content.Projection);

                            _swivelHide.Children.Add(showAnimation);
                        }
                    }
                }

                _swivelHide.Completed += delegate
                {
                    list.CloseGroupView();
                };
                _swivelHide.Begin();
            });
        }
Ejemplo n.º 3
0
 private void categoriesGroup_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
 {
     groupViewOpened = false;
 }
Ejemplo n.º 4
0
 private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
 {
     LongList.GroupViewClose(e);
 }
Ejemplo n.º 5
0
 private void countryList_GroupViewClosing(object sender, GroupViewClosingEventArgs e)
 {
     isGroupViewOpened = false;
 }