2 using Tizen.NUI.BaseComponents;
3 using Tizen.NUI.Components;
5 namespace NUITizenGallery
7 public partial class SwipeViewTest1Page : ContentPage
9 private PanGestureDetector panGestureDetector;
10 private Direction swipeDirection = Direction.Vertical;
11 private Position initPosition;
12 private int swipeCount;
20 public SwipeViewTest1Page()
22 InitializeComponent();
26 imageView.Scale = imageView.Scale * new Vector3(1.2f, 1.2f, 1.0f);
28 initPosition = imageView.Position;
30 ContentView.Padding = new Extents(20, 20, 20, 20);
32 panGestureDetector = new PanGestureDetector();
33 panGestureDetector.Attach(imageView);
34 panGestureDetector.Detected += (obj, e) =>
36 Vector2 velocity = e.PanGesture.Velocity;
37 if (e.PanGesture.State == Gesture.StateType.Started)
41 swipeDirection = Direction.Horizontal;
43 image1.Size = new Size(100, 100);
47 image2.Size = new Size(100, 100);
50 else if (velocity.Y != 0)
52 swipeDirection = Direction.Vertical;
55 if ((swipeCount % 2) > 0)
57 imageView.BorderlineWidth = 5f;
58 imageView.BorderlineColor = Color.Green;
62 imageView.BorderlineWidth = 0f;
70 else if (e.PanGesture.State == Gesture.StateType.Continuing)
72 if (swipeDirection == Direction.Vertical && imageView.Position.Y < 70 && imageView.Position.Y > -70)
74 imageView.Position += new Position(0, e.PanGesture.ScreenDisplacement.Y, 0);
76 else if (swipeDirection == Direction.Horizontal && imageView.Position.X < 70 && imageView.Position.X > -70)
78 imageView.Position += new Position(e.PanGesture.ScreenDisplacement.X, 0, 0);
81 else if (e.PanGesture.State == Gesture.StateType.Finished || e.PanGesture.State == Gesture.StateType.Cancelled)
83 imageView.Position = initPosition;
85 image1.Size = new Size(0, 0);
86 image2.Size = new Size(0, 0);