void Header_PointerReleased(object sender, PointerEventArgs e) { // Construct the appropriate destination page and set its context appropriately var group = (sender as FrameworkElement).DataContext as ICollectionViewGroup; var collection = group.Name as IEnumerable<Object>; App.ShowCollectionSummary(collection); }
void rectangle_PointerPressed(object sender, PointerEventArgs e) { ArtefactAnimator.AddEase( rectangle, UIElement.RenderTransformProperty, new CompositeTransform { ScaleX = 1.5, ScaleY = 1.5 }, 0.2, AnimationTransitions.CubicEaseOut, 0 ); }
private async void Image_PointerPressed_1(object sender, Windows.UI.Xaml.Input.PointerEventArgs e) { await App._DealBasket.AddToBasket(thisDeal.DealId); MessageDialog md = new MessageDialog("You have added a product to your trolley, cool eh. The total now comes to " + string.Format("{0:C}", App._DealBasket.BasketTotalPrice)); md.Commands.Add(new UICommand("ok", (command) => { appbar.IsOpen = true; }, "1")); await md.ShowAsync(); }
private void UpdatePosition(PointerEventArgs e) { double x = e.GetCurrentPoint(this).Position.X - (30 / 2); double y = e.GetCurrentPoint(this).Position.Y - (30 / 2); for (int n = 0; n < Items.Length; n++) { UIElement ball = Items[n]; double size = 20 + (rnd.NextDouble() * 150); double delay = (n * .01) + 0; // DEPENDENCY PROPERTY //ArtefactAnimator.AddEase(ball, new[] { Canvas.LeftProperty, Canvas.TopProperty }, new[] { x, y }, 2, AnimationTransitions.ElasticEaseOut, delay); // STRINGS ball.DimensionsTo(size, size, 3, AnimationTransitions.ElasticEaseOut, 0); EaseObject eo = ball.SlideTo(x + (size / 2), y + (size / 2), 1, AnimationTransitions.CubicEaseOut, delay); ArtefactAnimator.AddEase(ball, RenderTransformProperty, new CompositeTransform { Rotation = rnd.NextDouble() * 360 }, 4, AnimationTransitions.ElasticEaseOut, 0); } }
private void dealDetails_PointerExited2(object sender, PointerEventArgs e) { var stackpanel = (Grid)sender; stackpanel.SetValue(Grid.BackgroundProperty, Application.Current.Resources["ListViewItemOverlayBackgroundBrush"]); }
private void dealDetails_PointerEntered(object sender, PointerEventArgs e) { var stackpanel = (Grid)sender; stackpanel.SetValue(Grid.BackgroundProperty, Resources["mouseOver"]); }
private void dealDetails_PointerExited(object sender, Windows.UI.Xaml.Input.PointerEventArgs e) { var stackpanel = (StackPanel)sender; stackpanel.SetValue(StackPanel.BackgroundProperty, Application.Current.Resources["ListViewItemOverlayBackgroundBrush"]); }
/// <summary> /// Checks if the manipulation should cause a tilt, and if so starts the /// tilt effect. /// </summary> /// <param name="source">The source of the manipulation (the tilt /// container, eg entire page).</param> /// <param name="e">The args from the ManipulationStarted event.</param> private static void TryStartTiltEffect(FrameworkElement source, PointerEventArgs e) { FrameworkElement element = source; // VisualTreeHelper.GetChild(ancestor, 0) as FrameworkElement; FrameworkElement container = source;// e.Container as FrameworkElement; if (element == null || container == null) return; // Touch point relative to the element being tilted. Point tiltTouchPoint = e.GetCurrentPoint(element).Position; // container.TransformToVisual(element).TransformPoint(e.GetCurrentPoint(element)); // Center of the element being tilted. Point elementCenter = new Point(element.ActualWidth / 2, element.ActualHeight / 2); // Camera adjustment. Point centerToCenterDelta = GetCenterToCenterDelta(element, source); BeginTiltEffect(element, tiltTouchPoint, elementCenter, centerToCenterDelta, e.Pointer); return; }
void SilverlightGraphicsCanvas_PointerReleased(object sender, PointerEventArgs e) { var handle = new IntPtr(e.Pointer.PointerId); if (_activeTouches.ContainsKey(handle)) { var touch = _activeTouches[handle]; _activeTouches.Remove(handle); if (Delegate != null) { Delegate.TouchesEnded(new[] { touch }); } } }
private void dealDetails_PointerExited(object sender, Windows.UI.Xaml.Input.PointerEventArgs e) { var stackpanel = (Grid)sender; stackpanel.SetValue(Grid.BackgroundProperty, Resources["flagBackground"]); }
void SilverlightGraphicsCanvas_PointerPressed(DispatcherTimerTickEventArgs sender, PointerEventArgs e) { var handle = new IntPtr(e.Pointer.PointerId); //Debug.WriteLine (string.Format ("{0} PRESSED {1}", DateTime.Now, handle)); var now = DateTime.Now; var pos = ToPointF(e.GetCurrentPoint(this)); // // Look for double taps // var tapCount = 1; if (_lastDownTime.ContainsKey(handle) && _lastBeganPosition.ContainsKey(handle)) { var dt = now - _lastDownTime[handle]; if (dt.TotalSeconds < 0.5 && pos.DistanceTo(_lastBeganPosition[handle]) < DoubleClickMinDistance) { tapCount++; } } // // TouchBegan // var touch = new NetfxCoreTouch { Handle = handle, Time = now, SuperCanvasLocation = ToPointF(e.GetCurrentPoint((UIElement)Parent)), CanvasLocation = pos, TapCount = tapCount, IsMoving = false, }; touch.PreviousTime = touch.Time; touch.SuperCanvasPreviousLocation = touch.SuperCanvasLocation; touch.CanvasPreviousLocation = touch.CanvasLocation; _lastBeganPosition [handle] = pos; _lastDownTime[handle] = now; _activeTouches[handle] = touch; if (Content != null) { Content.TouchesBegan(new[] { touch }); } }
/// <summary> /// Continues a tilt effect that is currently applied to an element, /// presumably because the user moved their finger. /// </summary> /// <param name="element">The element being tilted.</param> /// <param name="e">The manipulation event args.</param> private static void ContinueTiltEffect(FrameworkElement element, PointerEventArgs e) { FrameworkElement container = element; if (container == null || element == null) { return; } Point tiltTouchPoint = e.GetCurrentPoint(element).Position; // If touch moved outside bounds of element, then pause the tilt // (but don't cancel it) if (new Rect(0, 0, currentTiltElement.ActualWidth, currentTiltElement.ActualHeight).Contains(tiltTouchPoint) != true) { PauseTiltEffect(); } else { // Apply the updated tilt effect ApplyTiltEffect(currentTiltElement, tiltTouchPoint, currentTiltElementCenter); } }
void BlankPage_PointerMoved(object sender, PointerEventArgs e) { UpdatePosition(e); }
private void imgPrice_PointerExited_1(object sender, PointerEventArgs e) { Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1); }
void SilverlightGraphicsCanvas_PointerExited(DispatcherTimerTickEventArgs sender, PointerEventArgs e) { var handle = new IntPtr (e.Pointer.PointerId); //Debug.WriteLine (string.Format ("{0} EXITED {1}", DateTime.Now, handle)); if (_activeTouches.ContainsKey (handle)) { var touch = _activeTouches[handle]; _activeTouches.Remove (handle); if (Content != null) { Content.TouchesCancelled (new[] { touch }); } } }
void SilverlightGraphicsCanvas_PointerMoved(DispatcherTimerTickEventArgs sender, PointerEventArgs e) { if (e.Pointer.IsInContact) { var handle = new IntPtr(e.Pointer.PointerId); //Debug.WriteLine (string.Format ("{0} MOVED {1}", DateTime.Now, handle)); if (_activeTouches.ContainsKey(handle)) { var touch = (NetfxCoreTouch)_activeTouches[handle]; var sloc = ToPointF (e.GetCurrentPoint ((UIElement)Parent)); var dx = sloc.X - touch.SuperCanvasLocation.X; var dy = sloc.Y - touch.SuperCanvasLocation.Y; if (touch.IsMoving || (Math.Abs (dx) > 1) || (Math.Abs (dy) > 1)) { touch.IsMoving = true; var loc = ToPointF (e.GetCurrentPoint (this)); touch.SuperCanvasPreviousLocation = touch.SuperCanvasLocation; touch.CanvasPreviousLocation = touch.CanvasLocation; touch.PreviousTime = touch.Time; touch.SuperCanvasLocation = sloc; touch.CanvasLocation = loc; touch.Time = DateTime.Now; if (Content != null) { Content.TouchesMoved (new[] { touch }); } } } } }
/// <summary> /// Event handler for ManipulationDelta /// </summary> /// <param name="sender">sender of the event - this will be the tilting /// object (eg a button).</param> /// <param name="e">Event arguments.</param> private static void TiltEffect_PointerMoved(object sender, PointerEventArgs e) { ContinueTiltEffect(sender as FrameworkElement, e); }
void SilverlightGraphicsCanvas_PointerReleased(object sender, PointerEventArgs e) { var handle = new IntPtr(e.Pointer.PointerId); //Debug.WriteLine (string.Format ("{0} RELEASED {1}", DateTime.Now, handle)); if (_activeTouches.ContainsKey(handle)) { var touch = _activeTouches[handle]; _activeTouches.Remove(handle); if (Content != null) { Content.TouchesEnded(new[] { touch }); } } }
/// <summary> /// Event handler for ManipulationStarted. /// </summary> /// <param name="sender">sender of the event - this will be the tilt /// container (eg, entire page).</param> /// <param name="e">Event arguments.</param> private static void TiltEffect_PointerPressed(object sender, PointerEventArgs e) { TryStartTiltEffect(sender as FrameworkElement, e); }
/// <summary> /// Event handler for ManipulationCompleted. /// </summary> /// <param name="sender">sender of the event - this will be the tilting /// object (eg a button).</param> /// <param name="e">Event arguments.</param> private static void TiltEffect_PointerReleased(object sender, PointerEventArgs e) { EndTiltEffect(currentTiltElement); }
void SilverlightGraphicsCanvas_PointerMoved(DispatcherTimerTickEventArgs sender, PointerEventArgs e) { if (e.Pointer.IsInContact) { var handle = new IntPtr(e.Pointer.PointerId); if (_activeTouches.ContainsKey(handle)) { var touch = _activeTouches[handle]; var sloc = ToPointF (e.GetCurrentPoint ((UIElement)Parent)); var loc = ToPointF (e.GetCurrentPoint (this)); touch.SuperCanvasPreviousLocation = touch.SuperCanvasLocation; touch.CanvasPreviousLocation = touch.CanvasLocation; touch.PreviousTime = touch.Time; touch.SuperCanvasLocation = sloc; touch.CanvasLocation = loc; touch.Time = DateTime.Now; if (Delegate != null) { Delegate.TouchesMoved(new[] { touch }); } } } }