/// <summary> /// Closes the group popup. /// </summary> /// <param name="selectedGroup">The selected group.</param> /// <param name="raiseEvent">Should the GroupPopupClosing event be raised.</param> /// <returns>True if the event was not raised or if it was raised and e.Handled is false.</returns> private bool ClosePopup(object selectedGroup, bool raiseEvent) { if (raiseEvent) { GroupViewClosingEventArgs args = null; SafeRaise.Raise(GroupViewClosing, this, () => { return args = new GroupViewClosingEventArgs(_itemsControl, selectedGroup); }); if (args != null && args.Cancel) { return false; } } if (_groupSelectorPopup != null) { RestoreSystemState(); _groupSelectorPopup.IsOpen = false; DetachFromPageEvents(); _groupSelectorPopup.Child = null; _border = null; _itemsControl = null; _groupSelectorPopup = null; } return true; }
/// <summary> /// Close the group popup. /// </summary> /// <param name="selectedGroup">The selected group.</param> /// <param name="raiseEvent">Should the GroupPopupClosing event be raised.</param> /// <returns>True if the event was not raised or if it was raised and e.Handled is false.</returns> private bool ClosePopup(object selectedGroup, bool raiseEvent) { if (raiseEvent) { GroupViewClosingEventArgs args = null; SafeRaise.Raise(GroupViewClosing, this, () => { return(args = new GroupViewClosingEventArgs(_itemsControl, selectedGroup)); }); if (args != null && args.Cancel) { return(false); } } if (_groupSelectorPopup != null) { RestoreSystemState(); _groupSelectorPopup.IsOpen = false; DetachFromPageEvents(); _groupSelectorPopup.Child = null; _border = null; _itemsControl = null; _groupSelectorPopup = null; } return(true); }
private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e) { //Cancelling automatic closing and scrolling to do it manually. e.Cancel = true; if (e.SelectedGroup != null) { currentSelector.ScrollToGroup(e.SelectedGroup); } //Dispatch the swivel animation for performance on the UI thread. 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 += _swivelHide_Completed; _swivelHide.Begin(); }); }
private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e) { e.Cancel = true; if (e.SelectedGroup != null) { this.currentSelector.ScrollToGroup(e.SelectedGroup); } base.Dispatcher.BeginInvoke(delegate { QuadraticEase ease = new QuadraticEase { EasingMode = EasingMode.EaseOut }; IEasingFunction function = ease; Storyboard storyboard = new Storyboard(); ItemsControl itemsControl = e.ItemsControl; foreach (object obj2 in itemsControl.Items) { UIElement reference = itemsControl.ItemContainerGenerator.ContainerFromItem(obj2) as UIElement; if (reference != null) { Border child = VisualTreeHelper.GetChild(reference, 0) as Border; if (child != null) { DoubleAnimationUsingKeyFrames element = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame frame = new EasingDoubleKeyFrame { KeyTime = System.TimeSpan.FromMilliseconds(0.0), Value = 0.0, EasingFunction = function }; EasingDoubleKeyFrame frame2 = new EasingDoubleKeyFrame { KeyTime = System.TimeSpan.FromMilliseconds(125.0), Value = 90.0, EasingFunction = function }; element.KeyFrames.Add(frame); element.KeyFrames.Add(frame2); Storyboard.SetTargetProperty(element, new PropertyPath(PlaneProjection.RotationXProperty)); Storyboard.SetTarget(element, child.Projection); storyboard.Children.Add(element); } } } storyboard.Completed += new System.EventHandler(this._swivelHide_Completed); storyboard.Begin(); }); }
private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e) { if (addedType != null) { TiltEffect.TiltableItems.Remove(addedType); addedType = null; } }