Esempio n. 1
0
        public NamedColorPage()
        {
            // This binding is necessary to label the tabs in
            //      the TabbedPage.
            this.SetBinding(ContentPage.TitleProperty, "Name");

            // BoxView to show the color.
            var boxView = new MR.Gestures.BoxView
            {
                WidthRequest      = 200,
                HeightRequest     = 100,
                HorizontalOptions = LayoutOptions.Center
            };

            boxView.SetBinding(BoxView.ColorProperty, "Color");
            boxView.Tapping      += (s, e) => Debug.WriteLine("BoxView Tapping {0} times", e.NumberOfTaps);
            boxView.Tapped       += (s, e) => Debug.WriteLine("BoxView Tapped");
            boxView.DoubleTapped += (s, e) => Debug.WriteLine("BoxView DoubleTapped");
            boxView.LongPressing += (s, e) => Debug.WriteLine("BoxView LongPressing");
            boxView.LongPressed  += (s, e) => Debug.WriteLine("BoxView LongPressed for {0} ms", e.Duration);
            boxView.Panning      += (s, e) => Debug.WriteLine("BoxView Panning {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
            boxView.Panned       += (s, e) => Debug.WriteLine("BoxView Panned {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
            boxView.Swiped       += (s, e) => Debug.WriteLine("BoxView Swiped {0}", e.Direction);
            boxView.Pinching     += (s, e) => Debug.WriteLine("BoxView Pinching TotalScale={0}", e.TotalScale);
            boxView.Pinched      += (s, e) => Debug.WriteLine("BoxView Pinched TotalScale={0}", e.TotalScale);
            boxView.Rotating     += (s, e) => Debug.WriteLine("BoxView Rotating Angle={0}", e.Angle);
            boxView.Rotated      += (s, e) => Debug.WriteLine("BoxView Rotated Angle={0}", e.Angle);

            // Build the page
            this.Content = new StackLayout
            {
                Children =
                {
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            CreateLabel("Color.R", "R = {0:F2}"),
                            CreateLabel("Color.G", "G = {0:F2}"),
                            CreateLabel("Color.B", "B = {0:F2}"),
                        }
                    },
                    boxView,
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        Children          =
                        {
                            CreateLabel("Color.Hue",        "Hue = {0:F2}"),
                            CreateLabel("Color.Saturation", "Saturation = {0:F2}"),
                            CreateLabel("Color.Luminosity", "Luminosity = {0:F2}")
                        }
                    }
                }
            };

            this.Tapping      += (s, e) => Debug.WriteLine("Detail Page Tapping {0} times", e.NumberOfTaps);
            this.Tapped       += (s, e) => Debug.WriteLine("Detail Page Tapped");
            this.DoubleTapped += (s, e) => Debug.WriteLine("Detail Page DoubleTapped");
            this.LongPressing += (s, e) => Debug.WriteLine("Detail Page LongPressing");
            this.LongPressed  += (s, e) => Debug.WriteLine("Detail Page LongPressed for {0} ms", e.Duration);
            //this.Panning += (s, e) => Debug.WriteLine("Detail Page Panning {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
            //this.Panned += (s, e) => Debug.WriteLine("Detail Page Panned {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
            //this.Swiped += (s, e) => Debug.WriteLine("Detail Page Swiped {0}", e.Direction);
            this.Pinching += (s, e) => Debug.WriteLine("Detail Page Pinching TotalScale={0}", e.TotalScale);
            this.Pinched  += (s, e) => Debug.WriteLine("Detail Page Pinched TotalScale={0}", e.TotalScale);
            this.Rotating += (s, e) => Debug.WriteLine("Detail Page Rotating Angle={0}", e.Angle);
            this.Rotated  += (s, e) => Debug.WriteLine("Detail Page Rotated Angle={0}", e.Angle);
        }
        public BoxViewCode()
        {
            this.Title = "Code";

            var box1 = new MR.Gestures.BoxView {
                Color = Color.Red
            };

            box1.Down         += (s, e) => { AddText("CodePage: Red Down " + e.TriggeringTouches.Length + " fingers"); };
            box1.Up           += (s, e) => { AddText("CodePage: Red Up " + e.TriggeringTouches.Length + " fingers"); };
            box1.Tapping      += (s, e) => { AddText("CodePage: Red Tapping " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
            box1.Tapped       += (s, e) => { AddText("CodePage: Red Tapped " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
            box1.DoubleTapped += (s, e) => { AddText("CodePage: Red DoubleTapped " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
            box1.LongPressing += (s, e) => { AddText("CodePage: Red LongPressing"); };
            box1.LongPressed  += (s, e) => { AddText("CodePage: Red LongPressed"); };
            box1.Pinching     += (s, e) => { AddText("CodePage: Red Pinching"); };
            box1.Pinched      += (s, e) => { AddText("CodePage: Red Pinched"); };
            box1.Panning      += (s, e) => { AddText("CodePage: Red Panning"); };
            box1.Panned       += (s, e) => { AddText("CodePage: Red Panned"); };
            box1.Swiped       += (s, e) => { AddText("CodePage: Red Swiped"); };
            box1.Rotating     += (s, e) => { AddText("CodePage: Red Rotating"); };
            box1.Rotated      += (s, e) => { AddText("CodePage: Red Rotated"); };

            var box2 = new MR.Gestures.BoxView {
                Color = Color.Green
            };

            box2.SetBinding(MR.Gestures.BoxView.DownCommandProperty, "DownCommand");
            box2.DownCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.UpCommandProperty, "UpCommand");
            box2.UpCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.TappingCommandProperty, "TappingCommand");
            box2.TappingCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.TappedCommandProperty, "TappedCommand");
            box2.TappedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.DoubleTappedCommandProperty, "DoubleTappedCommand");
            box2.DoubleTappedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.LongPressingCommandProperty, "LongPressingCommand");
            box2.LongPressingCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.LongPressedCommandProperty, "LongPressedCommand");
            box2.LongPressedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.PinchingCommandProperty, "PinchingCommand");
            box2.PinchingCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.PinchedCommandProperty, "PinchedCommand");
            box2.PinchedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.PanningCommandProperty, "PanningCommand");
            box2.PanningCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.PannedCommandProperty, "PannedCommand");
            box2.PannedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.SwipedCommandProperty, "SwipedCommand");
            box2.SwipedCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.RotatingCommandProperty, "RotatingCommand");
            box2.RotatingCommandParameter = "Green";
            box2.SetBinding(MR.Gestures.BoxView.RotatedCommandProperty, "RotatedCommand");
            box2.RotatedCommandParameter = "Green";

            var label = new Label();

            label.SetBinding(Label.TextProperty, "Text");
            var scroll = new ScrollView();

            scroll.Content = label;

            var layout = new RelativeLayout();

            layout.Children.Add(
                box1,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => parent.Width / 2),
                Constraint.RelativeToParent((parent) => parent.Height / 2)
                );

            layout.Children.Add(
                box2,
                Constraint.RelativeToParent((parent) => parent.Width / 2),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => parent.Width / 2),
                Constraint.RelativeToParent((parent) => parent.Height / 2)
                );


            layout.Children.Add(
                scroll,
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) => parent.Height / 2),
                Constraint.RelativeToParent((parent) => parent.Width),
                Constraint.RelativeToParent((parent) => parent.Height / 2)
                );

            this.Content = layout;
        }
Esempio n. 3
0
		public BoxViewCode()
		{
			this.Title = "Code";

			var box1 = new MR.Gestures.BoxView { Color = Color.Red };
			box1.Down += (s, e) => { AddText("CodePage: Red Down " + e.TriggeringTouches.Length + " fingers"); };
			box1.Up += (s, e) => { AddText("CodePage: Red Up " + e.TriggeringTouches.Length + " fingers"); };
			box1.Tapping += (s, e) => { AddText("CodePage: Red Tapping " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
			box1.Tapped += (s, e) => { AddText("CodePage: Red Tapped " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
			box1.DoubleTapped += (s, e) => { AddText("CodePage: Red DoubleTapped " + e.NumberOfTaps + " times with " + e.NumberOfTouches + " fingers"); };
			box1.LongPressing += (s, e) => { AddText("CodePage: Red LongPressing"); };
			box1.LongPressed += (s, e) => { AddText("CodePage: Red LongPressed"); };
			box1.Pinching += (s, e) => { AddText("CodePage: Red Pinching"); };
			box1.Pinched += (s, e) => { AddText("CodePage: Red Pinched"); };
			box1.Panning += (s, e) => { AddText("CodePage: Red Panning"); };
			box1.Panned += (s, e) => { AddText("CodePage: Red Panned"); };
			box1.Swiped			+= (s, e) => { AddText("CodePage: Red Swiped"); };
			box1.Rotating += (s, e) => { AddText("CodePage: Red Rotating"); };
			box1.Rotated += (s, e) => { AddText("CodePage: Red Rotated"); };

			var box2 = new MR.Gestures.BoxView { Color = Color.Green };
			box2.SetBinding(MR.Gestures.BoxView.DownCommandProperty, "DownCommand");
			box2.DownCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.UpCommandProperty, "UpCommand");
			box2.UpCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.TappingCommandProperty, "TappingCommand");
			box2.TappingCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.TappedCommandProperty, "TappedCommand");
			box2.TappedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.DoubleTappedCommandProperty, "DoubleTappedCommand");
			box2.DoubleTappedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.LongPressingCommandProperty, "LongPressingCommand");
			box2.LongPressingCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.LongPressedCommandProperty, "LongPressedCommand");
			box2.LongPressedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.PinchingCommandProperty, "PinchingCommand");
			box2.PinchingCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.PinchedCommandProperty, "PinchedCommand");
			box2.PinchedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.PanningCommandProperty, "PanningCommand");
			box2.PanningCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.PannedCommandProperty, "PannedCommand");
			box2.PannedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.SwipedCommandProperty, "SwipedCommand");
			box2.SwipedCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.RotatingCommandProperty, "RotatingCommand");
			box2.RotatingCommandParameter = "Green";
			box2.SetBinding(MR.Gestures.BoxView.RotatedCommandProperty, "RotatedCommand");
			box2.RotatedCommandParameter = "Green";

			var label = new Label();
			label.SetBinding(Label.TextProperty, "Text");
			var scroll = new ScrollView();
			scroll.Content = label;
			
			var layout = new RelativeLayout();

			layout.Children.Add(
					box1,
					Constraint.Constant(0),
					Constraint.Constant(0),
					Constraint.RelativeToParent((parent) => parent.Width / 2),
					Constraint.RelativeToParent((parent) => parent.Height / 2)
				);

			layout.Children.Add(
					box2,
					Constraint.RelativeToParent((parent) => parent.Width / 2),
					Constraint.Constant(0),
					Constraint.RelativeToParent((parent) => parent.Width / 2),
					Constraint.RelativeToParent((parent) => parent.Height / 2)
				);


			layout.Children.Add(
					scroll,
					Constraint.Constant(0),
					Constraint.RelativeToParent((parent) => parent.Height / 2),
					Constraint.RelativeToParent((parent) => parent.Width),
					Constraint.RelativeToParent((parent) => parent.Height / 2)
				);

			this.Content = layout;
		}
Esempio n. 4
0
        public NamedColorPage()
        {
            // This binding is necessary to label the tabs in 
            //      the TabbedPage.
            this.SetBinding(ContentPage.TitleProperty, "Name");

            // BoxView to show the color.
            var boxView = new MR.Gestures.BoxView
            {
                WidthRequest = 200,
                HeightRequest = 100,
                HorizontalOptions = LayoutOptions.Center
            };
            boxView.SetBinding(BoxView.ColorProperty, "Color");
			boxView.Tapping += (s, e) => Debug.WriteLine("BoxView Tapping {0} times", e.NumberOfTaps);
			boxView.Tapped += (s, e) => Debug.WriteLine("BoxView Tapped");
			boxView.DoubleTapped += (s, e) => Debug.WriteLine("BoxView DoubleTapped");
			boxView.LongPressing += (s, e) => Debug.WriteLine("BoxView LongPressing");
			boxView.LongPressed += (s, e) => Debug.WriteLine("BoxView LongPressed for {0} ms", e.Duration);
			boxView.Panning += (s, e) => Debug.WriteLine("BoxView Panning {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
			boxView.Panned += (s, e) => Debug.WriteLine("BoxView Panned {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
			boxView.Swiped += (s, e) => Debug.WriteLine("BoxView Swiped {0}", e.Direction);
			boxView.Pinching += (s, e) => Debug.WriteLine("BoxView Pinching TotalScale={0}", e.TotalScale);
			boxView.Pinched += (s, e) => Debug.WriteLine("BoxView Pinched TotalScale={0}", e.TotalScale);
			boxView.Rotating += (s, e) => Debug.WriteLine("BoxView Rotating Angle={0}", e.Angle);
			boxView.Rotated += (s, e) => Debug.WriteLine("BoxView Rotated Angle={0}", e.Angle);

            // Build the page
            this.Content = new StackLayout
            {
                Children = 
                {
                    new StackLayout
                    {   
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                        Children = 
                        {
                            CreateLabel("Color.R", "R = {0:F2}"),
                            CreateLabel("Color.G", "G = {0:F2}"),
                            CreateLabel("Color.B", "B = {0:F2}"),
                        }
                    },
                    boxView,
                    new StackLayout
                    {   
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                        Children = 
                        {
                            CreateLabel("Color.Hue", "Hue = {0:F2}"),
                            CreateLabel("Color.Saturation", "Saturation = {0:F2}"),
                            CreateLabel("Color.Luminosity", "Luminosity = {0:F2}")
                        }
                    }
                }
            };

			this.Tapping += (s, e) => Debug.WriteLine("Detail Page Tapping {0} times", e.NumberOfTaps);
			this.Tapped += (s, e) => Debug.WriteLine("Detail Page Tapped");
			this.DoubleTapped += (s, e) => Debug.WriteLine("Detail Page DoubleTapped");
			this.LongPressing += (s, e) => Debug.WriteLine("Detail Page LongPressing");
			this.LongPressed += (s, e) => Debug.WriteLine("Detail Page LongPressed for {0} ms", e.Duration);
			//this.Panning += (s, e) => Debug.WriteLine("Detail Page Panning {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
			//this.Panned += (s, e) => Debug.WriteLine("Detail Page Panned {0}/{1}", e.TotalDistance.X, e.TotalDistance.Y);
			//this.Swiped += (s, e) => Debug.WriteLine("Detail Page Swiped {0}", e.Direction);
			this.Pinching += (s, e) => Debug.WriteLine("Detail Page Pinching TotalScale={0}", e.TotalScale);
			this.Pinched += (s, e) => Debug.WriteLine("Detail Page Pinched TotalScale={0}", e.TotalScale);
			this.Rotating += (s, e) => Debug.WriteLine("Detail Page Rotating Angle={0}", e.Angle);
			this.Rotated += (s, e) => Debug.WriteLine("Detail Page Rotated Angle={0}", e.Angle);
        }