コード例 #1
0
            public AquaTemplate()
            {
                RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) });
                RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.8, GridUnitType.Star) });
                RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) });
                ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.05, GridUnitType.Star) });
                ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.95, GridUnitType.Star) });

                var topBoxView = new BoxView { Color = Color.Aqua };
                Children.Add (topBoxView, 0, 0);
                Grid.SetColumnSpan (topBoxView, 2);

                var topLabel = new Label {
                    Text = "Control Template Demo App",
                    TextColor = Color.Blue,
                    VerticalOptions = LayoutOptions.Center
                };
                Children.Add (topLabel, 1, 0);

                var contentPresenter = new ContentPresenter ();
                Children.Add (contentPresenter, 0, 1);
                Grid.SetColumnSpan (contentPresenter, 2);

                var bottomBoxView = new BoxView { Color = Color.Aqua };
                Children.Add (bottomBoxView, 0, 2);
                Grid.SetColumnSpan (bottomBoxView, 2);

                var bottomLabel = new Label {
                    Text = "(c) Xamarin 2016",
                    TextColor = Color.Blue,
                    VerticalOptions = LayoutOptions.Center
                };
                Children.Add (bottomLabel, 1, 2);
            }
コード例 #2
0
		public PanGestureExample3 ()
		{
			InitializeComponent ();
			MainLayout.OnLayoutChildren += MainLayout_OnLayoutChildren;

			OuterView = new StackLayout {
				Padding = new Thickness (50),
				BackgroundColor = Color.Yellow
			};
			this.MainLayout.Children.Add (OuterView);
			OuterView.Layout (_outerLayoutBounds);

			Box = new BoxView {
				Color = Color.Red,
				WidthRequest = 150,
				HeightRequest = 150,
			};
			OuterView.Children.Add (Box);
			var panRecognizer = new PanGestureRecognizer ();
			panRecognizer.IsConsumingTouchesInParallel = true;
			panRecognizer.OnAction += Gesture_OnAction;
			Box.AddGestureRecognizer (panRecognizer);

			Box2 = new BoxView ();
			Box2.Color = Color.Blue;
			this.MainLayout.Children.Add (Box2);
			Box2.Layout (_box2Bounds);
			panRecognizer = new PanGestureRecognizer ();
			panRecognizer.OnAction += Gesture_OnAction;
			panRecognizer.IsConsumingTouchesInParallel = true;
			Box2.AddGestureRecognizer (panRecognizer);
			DoBoxAnimation ();

		}
コード例 #3
0
		public StackLayoutDemoCode ()
		{
			Title = "StackLayout Demo - C#";
			layout = new StackLayout { Spacing = 0 };
			StackChangeButton = new Button {
				Text = "Spacing: 0",
				FontSize = 20,
				VerticalOptions = LayoutOptions.Start,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			StackChangeButton.Clicked += StackChangeButton_Clicked;
			BoxView yellowBox = new BoxView {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Color = Color.Yellow
			};
			BoxView greenBox = new BoxView {
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Color = Color.Green
			};
			BoxView blueBox = new BoxView {
				VerticalOptions = LayoutOptions.End,
				HorizontalOptions = LayoutOptions.FillAndExpand,
				Color = Color.Blue,
				HeightRequest = 75
			};
			layout.Children.Add (StackChangeButton);
			layout.Children.Add (yellowBox);
			layout.Children.Add (greenBox);
			layout.Children.Add (blueBox);
			Content = layout;
		}
コード例 #4
0
		public CardStatusView (Card card)
		{
			var statusBoxView = new BoxView {
				VerticalOptions = LayoutOptions.Fill,
				HorizontalOptions = LayoutOptions.Fill
			};

			switch (card.Status) {
			case  CardStatus.Alert:
				statusBoxView.BackgroundColor = StyleKit.Status.AlertColor;
				break;
			case CardStatus.Completed:
				statusBoxView.BackgroundColor = StyleKit.Status.CompletedColor;
				break;
			case CardStatus.Unresolved:
				statusBoxView.BackgroundColor = StyleKit.Status.UnresolvedColor;
				break;
			default:
				statusBoxView.BackgroundColor = StyleKit.Status.UnresolvedColor;
				break;
			}
			;

			Content = statusBoxView;
		}
コード例 #5
0
        //View
        public BoxViewDemoPage()
        {
            var heading = new Label
            {
                Text = "BoxView",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.StartAndExpand,
                FontSize = 50,
                FontAttributes = FontAttributes.Bold | FontAttributes.Italic
            };

            var boxView = new BoxView
            {
                Color = Color.Red,
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            var mainLayout = new StackLayout
            {
                Children =
                {
                    heading,
                    boxView
                }
            };

            Content = mainLayout;
        }
コード例 #6
0
        void AddSomeGesturesUsingCode()
        {
            //2 options:
            //1. use the standard xamarin api. e.g. view.GestureRecgonizers.Add(yourgesturerecognizer)
            //    and then call view.ProcessGestures();
            //    this has the benefit that when Xamarin add an api hook we can remove the view.ProcessGestures call and
            //    it will all be good.
            //2. use the extension method view.AddGestureRecognizer(yourgesturerecognizer)
            //    this is easier to use; and does everything under the hood; but it's a bit more obtrusive.
            //   in all cases, until Xamarin do more to open up the api, you must use the view extension method
            //   removeGestureRecognizer
            // comment on https://bugzilla.xamarin.com/show_bug.cgi?id=30467 to get Xamarin to expand
            // IGestureRecognizer with some add/remove hooks
            var panRecognizer = new PanGestureRecognizer ();
            panRecognizer.OnAction += OnAction;
            var Box3 = new BoxView () {
                Color = Color.Olive,
            };

            MainLayout.Children.Add (Box3);
            Box3.Layout (new Rectangle (100, 400, 100, 100));
            //			Box3.AddGestureRecognizer (panRecognizer);

            var panRecognizerWith2Tocuhes = new TwinTechs.Gestures.PanGestureRecognizer ();
            panRecognizerWith2Tocuhes.OnAction += OnAction;
            panRecognizerWith2Tocuhes.MinimumNumberOfTouches = 2;
            Label2.GestureRecognizers.Add (panRecognizerWith2Tocuhes);
            Label2.ProcessGestureRecognizers ();
        }
コード例 #7
0
        public ChessboardFixed()
        {
            const double squareSize = 35;

            AbsoluteLayout absoluteLayout = new AbsoluteLayout
            {
                BackgroundColor = Color.FromRgb(240, 220, 130),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };

            for (int row = 0; row < 8; row++)
            {
                for (int col = 0; col < 8; col++)
                {
                    //Skip every other square.
                    if (((row ^ col) & 1) == 0)
                        continue;

                    BoxView boxView = new BoxView
                    {
                        Color = Color.FromRgb(0, 64, 0)
                    };

                    Rectangle rect = new Rectangle(col * squareSize,
                        row * squareSize,
                        squareSize, squareSize);

                    absoluteLayout.Children.Add(boxView, rect);
                }
            }

            this.Content = absoluteLayout;
        }
コード例 #8
0
        public ChessboardDynamicPage()
        {
            absoluteLayout = new AbsoluteLayout
            {
                BackgroundColor = Color.FromRgb(240, 220, 130),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };

            for (int i = 0; i < 32; i++)
            {
                BoxView boxView = new BoxView
                {
                    Color = Color.FromRgb(0, 64, 0)
                };
                absoluteLayout.Children.Add(boxView);
            }

            ContentView contentView = new ContentView
            {
                Content = absoluteLayout
            };
            contentView.SizeChanged += OnContentViewSizeChanged;

            this.Padding = new Thickness(5, Device.OnPlatform(25, 5, 5), 5, 5);
            this.Content = contentView;
        }
コード例 #9
0
        public BoxViewDemoPage()
        {
            Label header = new Label
            {
                Text = "BoxView",
                Font = Font.SystemFontOfSize(50, FontAttributes.Bold),
                HorizontalOptions = LayoutOptions.Center
            };

            BoxView boxView = new BoxView
            {
                Color = Color.Accent,
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    boxView
                }
            };
        }
コード例 #10
0
        public GridBarChartPage()
        {
            InitializeComponent();

            List<View> views = new List<View>();
            TapGestureRecognizer tapGesture = new TapGestureRecognizer();
            tapGesture.Tapped += OnBoxViewTapped;

            // Create BoxView elements and add to List.
            for (int i = 0; i < COUNT; i++)
            {
                BoxView boxView = new BoxView
                {
                    Color = Color.Accent,
                    HeightRequest = 300 * random.NextDouble(),
                    VerticalOptions = LayoutOptions.End,
                    StyleId = RandomNameGenerator()
                };
                boxView.GestureRecognizers.Add(tapGesture);
                views.Add(boxView);
            }

            // Add whole List of BoxView elements to Grid.
            grid.Children.AddHorizontal(views);

            // Start a timer at the frame rate.
            Device.StartTimer(TimeSpan.FromMilliseconds(15), OnTimerTick);
        }
コード例 #11
0
		public TaskItemCell ()
		{
			var label = new Label {
				YAlign = TextAlignment.Center
			};
			var stripe = new BoxView {
				Color = Color.Red
			};
			label.SetBinding (Label.TextProperty, new Binding ("Name"));
			stripe.SetBinding (BoxView.IsVisibleProperty, new Binding ("Completed"));

			var layout = new RelativeLayout {
				HorizontalOptions = LayoutOptions.StartAndExpand,
				VerticalOptions = LayoutOptions.StartAndExpand
			};
			layout.Children.Add (
				label, 
				Constraint.RelativeToParent (p => 20),
				Constraint.RelativeToParent (p => 0),
				Constraint.RelativeToParent (p => p.Width - 40),
				Constraint.RelativeToParent (p => p.Height));
			layout.Children.Add (
				stripe, 
				Constraint.RelativeToParent (p => 10),
				Constraint.RelativeToParent (p => (p.Height / 2) - 1),
				Constraint.RelativeToParent (p => p.Width - 20),
				Constraint.RelativeToParent (p => 2));
			View = layout;
		}
コード例 #12
0
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(TItleView));
     boxView = this.FindByName<BoxView>("boxView");
     colorNameLabel = this.FindByName<Label>("colorNameLabel");
     colorValueLabel = this.FindByName<Label>("colorValueLabel");
 }
コード例 #13
0
		public RelativeLayoutDemoCode ()
		{
			Title = "Relative Layout Demo - C#";
			outerLayout = new AbsoluteLayout ();
			layout = new RelativeLayout ();
			centerLabel = new Label { FontSize = 20, Text = "RelativeLayout Demo"};
			buttonLayout = new AbsoluteLayout ();
			box = new BoxView { Color = Color.Blue, HeightRequest = 50, WidthRequest = 50 };
			layout.Children.Add (box, Constraint.RelativeToParent ((parent) => {
				return (parent.Width * .5) - 50;
			}), Constraint.RelativeToParent ((parent) => {
				return (parent.Height * .1) - 50;
			}));
			layout.Children.Add (centerLabel, Constraint.RelativeToParent ((parent) => {
				return (parent.Width * .5) - 50;
			}), Constraint.RelativeToParent ((parent) => {
				return (parent.Height * .5) - 50;
			}));
			moveButton = new Button { BackgroundColor = Color.White, FontSize = 20, TextColor = Color.Lime, Text = "Move", BorderRadius = 0};
			buttonLayout.Children.Add (moveButton, new Rectangle(0,1,1,1), AbsoluteLayoutFlags.All);
			outerLayout.Children.Add (layout, new Rectangle(0,0,1,1), AbsoluteLayoutFlags.All);
			outerLayout.Children.Add (buttonLayout, new Rectangle(0,1,1,50), AbsoluteLayoutFlags.PositionProportional|AbsoluteLayoutFlags.WidthProportional);

			moveButton.Clicked += MoveButton_Clicked;
			x = 0f;
			y = 0f;
			Content = outerLayout;
		}
        public NetworkStatusPage()
        {
            var networkLabel = new Label {
                Text = "Network Status",
                YAlign = TextAlignment.Center
            };
            var networkBox = new BoxView {
                Color = Color.White,
                HeightRequest = 25,
                WidthRequest = 25
            };

            var networkStack = new StackLayout {
                Orientation = StackOrientation.Horizontal,
                Padding = 15,
                Spacing = 25,
                Children = { networkLabel, networkBox }
            };

            var button = new Button {
                Text = "Update Status",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            button.Clicked += (sender, e) => {
                var service = DependencyService.Get<INetworkService>();
                var isConnected = service.IsConnected();

                networkBox.Color = isConnected ? Color.Green : Color.Red;
            };

            Content = new StackLayout {
                Children = { networkStack, button }
            };
        }
コード例 #15
0
			public TealTemplate ()
			{
				RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) });
				RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.8, GridUnitType.Star) });
				RowDefinitions.Add (new RowDefinition { Height = new GridLength (0.1, GridUnitType.Star) });
				ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.05, GridUnitType.Star) });
				ColumnDefinitions.Add (new ColumnDefinition { Width = new GridLength (0.95, GridUnitType.Star) });

				var topBoxView = new BoxView { Color = Color.Teal };
				Children.Add (topBoxView, 0, 0);
				Grid.SetColumnSpan (topBoxView, 2);

				var topLabel = new Label {
					TextColor = Color.White,
					VerticalOptions = LayoutOptions.Center
				};
				topLabel.SetBinding (Label.TextProperty, new TemplateBinding ("Parent.HeaderText"));
				Children.Add (topLabel, 1, 0);

				var contentPresenter = new ContentPresenter ();
				Children.Add (contentPresenter, 0, 1);
				Grid.SetColumnSpan (contentPresenter, 2);

				var bottomBoxView = new BoxView { Color = Color.Teal };
				Children.Add (bottomBoxView, 0, 2);
				Grid.SetColumnSpan (bottomBoxView, 2);

				var bottomLabel = new Label {
					TextColor = Color.White,
					VerticalOptions = LayoutOptions.Center
				};
				bottomLabel.SetBinding (Label.TextProperty, new TemplateBinding ("Parent.FooterText"));
				Children.Add (bottomLabel, 1, 2);
			}
コード例 #16
0
        public OrderListHeaderView()
        {
            HeightRequest = Sizes.LargeRowHeight;

            #region add new order image
            AddNewOrderImage = new Image()
            {
                Aspect = Aspect.AspectFit
            };
            Device.OnPlatform(
                iOS: () => AddNewOrderImage.Source = new FileImageSource(){ File = "add_ios_blue" }, 
                Android: () => AddNewOrderImage.Source = new FileImageSource() { File = "add_android_blue" }
            );

            AddNewOrderImage.IsVisible = Device.OS != TargetPlatform.Android;
            #endregion

            #region add new order label
            AddNewOrderTextLabel = new Label
            {
                Text = TextResources.Customers_Orders_NewOrder.ToUpper(),
                TextColor = Palette._004,
                XAlign = TextAlignment.Start,
                YAlign = TextAlignment.Center,
            };
            #endregion

            #region compose view hierarchy
            BoxView bottomBorder = new BoxView() { BackgroundColor = Palette._013, HeightRequest = 1 };

            const double imagePaddingPercent = .35;

            RelativeLayout relativeLayout = new RelativeLayout();

            relativeLayout.Children.Add(
                view: AddNewOrderImage,
                yConstraint: Constraint.RelativeToParent(parent => parent.Height * imagePaddingPercent),
                xConstraint: Constraint.RelativeToParent(parent => parent.Height * imagePaddingPercent),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Height - (parent.Height * imagePaddingPercent * 2)),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height - (parent.Height * imagePaddingPercent * 2)));

            relativeLayout.Children.Add(
                view: AddNewOrderTextLabel,
                xConstraint: Constraint.RelativeToView(AddNewOrderImage, (parent, view) => view.X + (view.Width / 2) + parent.Height * imagePaddingPercent),
                widthConstraint: Constraint.RelativeToView(AddNewOrderImage, (parent, view) => parent.Width - view.Width),
                heightConstraint: Constraint.RelativeToParent(parent => parent.Height)
            );

            relativeLayout.Children.Add(
                view: bottomBorder,
                yConstraint: Constraint.RelativeToParent(parent => parent.Height - 1),
                widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
                heightConstraint: Constraint.Constant(1)
            );
            #endregion

           
            Content = relativeLayout;

        }
コード例 #17
0
		public MainPageCS ()
		{
			ItemTemplate = new DataTemplate (() => {
				var nameLabel = new Label {
					FontSize = Device.GetNamedSize (NamedSize.Medium, typeof(Label)),
					HorizontalOptions = LayoutOptions.Center
				};
				nameLabel.SetBinding (Label.TextProperty, "Name");

				var colorBoxView = new BoxView {
					WidthRequest = 200,
					HeightRequest = 200,
					HorizontalOptions = LayoutOptions.Center,
					VerticalOptions = LayoutOptions.CenterAndExpand
				};
				colorBoxView.SetBinding (BoxView.ColorProperty, "Color");

				return new ContentPage {
					Padding = new Thickness (0, Device.OnPlatform (40, 40, 0), 0, 0),
					Content = new StackLayout {
						Children = {
							nameLabel,
							colorBoxView
						}
					}
				};
			});

			ItemsSource = ColorsDataModel.All;
		}
		public AbsoluteLayoutExplorationCode ()
		{
			Title = "Absolute Layout Exploration - C#";
			var layout = new AbsoluteLayout();

			var centerLabel = new Label {Text = "I'm centered on iPhone 4 but no other device.", LineBreakMode = LineBreakMode.WordWrap, FontSize = 20};

			AbsoluteLayout.SetLayoutBounds (centerLabel, new Rectangle (115, 159, 100, 100));
			// it is not necessary to set layout flags because absolute positioning is the default

			var bottomLabel = new Label { Text = "I'm bottom center on every device.", LineBreakMode = LineBreakMode.WordWrap };
			AbsoluteLayout.SetLayoutBounds (bottomLabel, new Rectangle (.5, 1, .5, .1));
			AbsoluteLayout.SetLayoutFlags (bottomLabel, AbsoluteLayoutFlags.All);

			var rightBox = new BoxView{ Color = Color.Olive };
			AbsoluteLayout.SetLayoutBounds (rightBox, new Rectangle (1, .5, 25, 100));
			AbsoluteLayout.SetLayoutFlags (rightBox, AbsoluteLayoutFlags.PositionProportional);

			var leftBox = new BoxView{ Color = Color.Red };
			AbsoluteLayout.SetLayoutBounds (leftBox, new Rectangle (0, .5, 25, 100));
			AbsoluteLayout.SetLayoutFlags (leftBox, AbsoluteLayoutFlags.PositionProportional);

			var topBox = new BoxView{ Color = Color.Blue };
			AbsoluteLayout.SetLayoutBounds (topBox, new Rectangle (.5, 0, 100, 25));
			AbsoluteLayout.SetLayoutFlags (topBox, AbsoluteLayoutFlags.PositionProportional);

			layout.Children.Add (bottomLabel);
			layout.Children.Add (centerLabel);
			layout.Children.Add (rightBox);
			layout.Children.Add (leftBox);
			layout.Children.Add (topBox);

			Content = layout;
		}
コード例 #19
0
        public ClockPage()
        {
            AbsoluteLayout absoluteLayout = new AbsoluteLayout();

            for (int i = 0; i < tickMarks.Length; i++)
            {
                tickMarks[i] = new BoxView
                {
                    Color = Color.Accent
                };
                absoluteLayout.Children.Add(tickMarks[i]);
            }

            absoluteLayout.Children.Add(hourHand =
                new BoxView
                {
                    Color = Color.Accent
                });
            absoluteLayout.Children.Add(minuteHand =
                new BoxView
                {
                    Color = Color.Accent
                });
            absoluteLayout.Children.Add(secondHand =
                new BoxView
                {
                    Color = Color.Red
                });

            Content = absoluteLayout;

            Device.StartTimer(TimeSpan.FromMilliseconds(16), OnTimerTick);
            SizeChanged += OnPageSizeChanged;
        }
コード例 #20
0
        public App()
        {
            _grid = new Grid {
                BackgroundColor = Color.Purple, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand
            };

            // THIS BOX VIEW DOES NOT SHOW UP IF YOU RE-SIZE THE ROW DEFINITION
            var boxView = new BoxView { BackgroundColor = Color.Blue, VerticalOptions = LayoutOptions.End };

            var button = new Button
            {
                Text = "button",
                BackgroundColor = Color.Lime,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center
            };

            button.Clicked += (sender, e) =>
            {
                _grid.RowDefinitions[1].Height = Math.Abs(_grid.RowDefinitions[1].Height.Value - 100) < double.Epsilon ?
                                                                                                new GridLength(0) : new GridLength(100);
            };

            Grid.SetRow(boxView, 1);

            _grid.RowDefinitions.Add(new RowDefinition() { Height = 100 });
            _grid.RowDefinitions.Add(new RowDefinition() { Height = 0 }); // CHANGE THIS TO 100 and it works fine

            _grid.Children.Add(boxView);
            _grid.Children.Add(button);

            MainPage = new ContentPage { Content = _grid };
        }
コード例 #21
0
        private void SetContent()
        {
            for (int i = 0; i < tickMarks.Length; i++)
            {
                tickMarks[i] = new BoxView
                {
                    Color = Color.Yellow
                };
                absoluteLayout.Children.Add(tickMarks[i]);
            }

            absoluteLayout.Children.Add(hourHand =
                new BoxView
                {
                    Color = Color.Lime
                });
            absoluteLayout.Children.Add(minuteHand =
                new BoxView
                {
                    Color = Color.Green
                });
            absoluteLayout.Children.Add(secondHand =
                new BoxView
                {
                    Color = Color.Teal
                });

            Content = absoluteLayout;
        }
コード例 #22
0
        public BoxViewDemoPage()
        {
            Label header = new Label
            {
                Text = "BoxView",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            BoxView boxView = new BoxView
            {
                Color = Color.Accent,
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    boxView
                }
            };
        }
コード例 #23
0
ファイル: NickPage.cs プロジェクト: Grawl/hubbl
        public NickPage()
        {
            rand = new Random ();
            var image = new Image () {
                Source = new FileImageSource() {File = "*****@*****.**"},
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Aspect = Aspect.AspectFit,
                HeightRequest = 200,
            };

            var about = new Label{
                Text = "Музыкальный плеер с удаленным управлениях",
                VerticalOptions = LayoutOptions.Center,
                XAlign = TextAlignment.Center
            };
            var nameLabel = new Label {
                Text = "Ваше имя в сети",
                VerticalOptions = LayoutOptions.End,
                XAlign = TextAlignment.Center
            };
            var nickLabel = new Label{
                Text = GenerateNewName (),
                XAlign = TextAlignment.Center,
                FontSize = 24.0,
                VerticalOptions = LayoutOptions.End
            };
            var box = new BoxView (){ MinimumHeightRequest = 40 };
            var refresh = new Button ();
            refresh.Image = new FileImageSource () { File = "*****@*****.**" };
            refresh.Clicked += (sender, e) => {
                var name = GenerateNewName();
                nickLabel.Text = name;
            };
            refresh.VerticalOptions = LayoutOptions.End;
            //refresh.Text = "Выбрать другое";

            var continueButton = new Button ();
            continueButton.Text = "Пойдет";
            continueButton.Clicked += (sender, e) => {
                var session = App.Container.Resolve<ISession>();
                session.CurrentUser.Title = nickLabel.Text;
                Navigation.PushAsync(new HubsPage());
            };
            continueButton.VerticalOptions = LayoutOptions.End;

            Content = new StackLayout {
                Padding = 5,
                Spacing = 15,
                Children = {
                    image,
                    about,
                    box,
                    nameLabel,
                    nickLabel,
                    refresh,
                    continueButton,
                }
            };
        }
コード例 #24
0
        public LayoutComentaryCompartir()
        {
            BoxView linea = new BoxView () {
                Color = Color.Gray,
                HeightRequest=1
            };

            this.Children.Add (linea,
                Constraint.Constant (5),
                Constraint.Constant (0),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width-10;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 1;
                }));

            Label lblcomentar = new Label () {
                Text="Comentar",
                FontSize=9,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                TextColor = Color.Gray
            };

            this.Children.Add (lblcomentar,
                Constraint.Constant (0),
                Constraint.Constant (1),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 15;
                }));

            Label lblcompartir = new Label () {
                Text="Compartir",
                FontSize=9,
                FontAttributes = FontAttributes.Bold,
                XAlign = TextAlignment.Center,
                TextColor = Color.Gray,
                YAlign = TextAlignment.Center,
            };

            this.Children.Add (lblcompartir,
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2;
                }),
                Constraint.Constant (1),
                Constraint.RelativeToParent ((Parent) => {
                    return Parent.Width/2;
                }),
                Constraint.RelativeToParent ((Parent) => {
                    return 15;
                }));
        }
コード例 #25
0
        public PickerDemoPage()
        {
            Label header = new Label
            {
                Text = "Picker",
                Font = Font.BoldSystemFontOfSize(50),
                HorizontalOptions = LayoutOptions.Center
            };

            Picker picker = new Picker
            {
                Title = "Color",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            foreach (string colorName in nameToColor.Keys)
            {
                picker.Items.Add(colorName);
            }

            // Create BoxView for displaying picked Color
            BoxView boxView = new BoxView
            {
                WidthRequest = 150,
                HeightRequest = 150,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            picker.SelectedIndexChanged += (sender, args) =>
                {
                    if (picker.SelectedIndex == -1)
                    {
                        boxView.Color = Color.Default;
                    }
                    else
                    {
                        string colorName = picker.Items[picker.SelectedIndex];
                        boxView.Color = nameToColor[colorName];
                    }
                };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

            // Build the page.
            this.Content = new StackLayout
            {
                Children = 
                {
                    header,
                    picker,
                    boxView
                }
            };

        }
 private void InitializeComponent()
 {
     this.LoadFromXaml(typeof(MatrixCellControlPrototype));
     grdRoot = this.FindByName<Grid>("grdRoot");
     cnvTitle = this.FindByName<ContentView>("cnvTitle");
     lblTitle = this.FindByName<Label>("lblTitle");
     cnvBorder = this.FindByName<ContentView>("cnvBorder");
     cnvColor = this.FindByName<BoxView>("cnvColor");
 }
コード例 #27
0
        public CardStatusView()
        {
            statusBoxView = new BoxView {
                VerticalOptions = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                BackgroundColor = CheeseColors.LIGHT_GREEN
            };

            Content = statusBoxView;
        }
コード例 #28
0
		public RelativeLayoutDemo()
		{
			InitializeComponent();
			moveButton.Clicked += MoveButton_Clicked;
			x = 0f;
			y = 0f;
			center = new BoxView ();
			/*status.Text = "the anchor point of a child is interpollated based on its position\n\n" +
				"the white vertical line represents the X anchor point";*/
		}
コード例 #29
0
		public ColorAnimationPageCS()
		{
			Title = "Color Animations";
			Icon = "csharp.png";

			boxView = new BoxView { Color = Color.Blue, HeightRequest = 100, HorizontalOptions = LayoutOptions.FillAndExpand };
			label = new Label
			{
				Text = "Loreom ipsum dolar sit amet",
				FontSize = 24,
				FontAttributes = FontAttributes.Bold,
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand
			};

			var animateBoxViewButton = new Button
			{
				Text = "Animate BoxView",
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand
			};
			animateBoxViewButton.Clicked += OnAnimateBoxViewButtonClicked;

			var animateLabelButton = new Button
			{
				Text = "Animate Label",
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand
			};
			animateLabelButton.Clicked += OnAnimateLabelButtonClicked;

			var animatePageBackgroundButton = new Button
			{
				Text = "Animate Page Background",
				HorizontalOptions = LayoutOptions.Center,
				VerticalOptions = LayoutOptions.CenterAndExpand
			};
			animatePageBackgroundButton.Clicked += OnAnimatePageBackgroundButtonClicked;

			cancelButton = new Button { Text = "Cancel Animation", IsEnabled = false };
			cancelButton.Clicked += OnCancelAnimationButtonClicked;

			Content = new StackLayout
			{
				Margin = new Thickness(10, 20, 10, 20),
				Children = {
					boxView,
					animateBoxViewButton,
					label,
					animateLabelButton,
					animatePageBackgroundButton,
					cancelButton
				}
			};
		}
コード例 #30
0
ファイル: AccountBasic.cs プロジェクト: pratik8490/TextShield
        /// <summary>
        /// Account Basic Layout.
        /// </summary>
        public void AccountBasicLayout()
        {
            BoxView bvDGA = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            BoxView bvPA = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            BoxView bvPD = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            BoxView bvDN = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            BoxView bvState = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            BoxView bvPostalCode = new BoxView { HeightRequest = 1, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black };

            Label lblDGA = new Label { Text = "Dealer Group Association", TextColor = Color.Black };

            Label lblPA = new Label { Text = "Partner Association", TextColor = Color.Black };

            Label lblPD = new Label { Text = "Parent Designation", TextColor = Color.Black };

            Label lblDN = new Label { Text = "Dealership Name", TextColor = Color.Black };

            Label lblSA = new Label { Text = "Street Address", TextColor = Color.Black };

            Label lblCity = new Label { Text = "City", TextColor = Color.Black };

            Label lblState = new Label { Text = "State", TextColor = Color.Black };

            Label lblPostalCode = new Label { Text = "Postal Code", TextColor = Color.Black };

            Label lblblue1 = new Label { Text = "McPherson Ford", TextColor = Color.Blue };

            Label lblblue2 = new Label { Text = "McPherson Ford", TextColor = Color.Blue };

            Label lblblue3 = new Label { Text = "McPherson Ford", TextColor = Color.Blue };

            Label lblblue4 = new Label { Text = "Alabama", TextColor = Color.Blue };

            Entry txtDN = new Entry { TextColor = Color.Black, BackgroundColor = Color.FromHex("#d3d3d3") };

            Entry txtAddress1 = new Entry { TextColor = Color.Black, BackgroundColor = Color.FromHex("#d3d3d3") };

            Entry txtAddress2 = new Entry { TextColor = Color.Black, BackgroundColor = Color.FromHex("#d3d3d3") };

            Entry txtCity = new Entry { TextColor = Color.Black, BackgroundColor = Color.FromHex("#d3d3d3") };

            Entry txtPostalCode = new Entry { TextColor = Color.Black, BackgroundColor = Color.FromHex("#d3d3d3") };

            StackLayout slTest = new StackLayout { Children = { bvDGA, lblDGA, lblblue1, bvPA, lblPA, lblblue2, bvPD, lblPD, lblblue3, bvDN, lblDN, txtDN, lblSA, txtAddress1, txtAddress2, lblCity, txtCity, lblState, lblblue4, bvPostalCode, lblPostalCode, txtPostalCode, bvPostalCode }, Padding = new Thickness(10, 10, 10, 10), BackgroundColor = Color.White };

            Content = new ScrollView
            {
                Content = slTest
            };
        }
コード例 #31
0
        public MainPage()
        {
            Grid abs = new Grid();

            bok = new BoxView {
                Color = Color.Black
            };
            abs.Children.Add(bok, 0, 0);

            bokl = new Label {
                BackgroundColor = Color.Coral, Text = "кнопка"
            };
            abs.Children.Add(bokl, 0, 1);
            Grid.SetColumnSpan(bokl, 3);
            Grid.SetRowSpan(bokl, 2);

            Content = abs;
        }
コード例 #32
0
        public void NewGame(Grid grid)
        {
            ShowScore();
            for (int i = 0; i < count * 2 + 1; i++)
            {
                int c  = i % 2 == 0 ? 1 : 3;
                var rd = new RowDefinition()
                {
                    Height = new GridLength(c, GridUnitType.Star)
                };
                var cd = new ColumnDefinition()
                {
                    Width = new GridLength(c, GridUnitType.Star)
                };
                grid.RowDefinitions.Add(rd);
                grid.ColumnDefinitions.Add(cd);
            }

            Xamarin.Forms.BoxView shape;
            string id   = "";
            int    last = count * 2 + 1;

            for (int i = 0; i < last; i++)
            {
                bool start = true;
                for (int j = 0; j < last; j++)
                {
                    if ((i + j) % 2 == 0)
                    {
                        shape = new Xamarin.Forms.BoxView()
                        {
                            BackgroundColor = vertexColor
                        };
                        Xamarin.Forms.Grid.SetRow(shape, i);
                        Xamarin.Forms.Grid.SetColumn(shape, j);
                        grid.Children.Add(shape);
                        if (j % 2 != 0)
                        {
                            shape.BackgroundColor = edgeDefaultColor;
                            houseDict.Add(++houseCount, new House(count)
                            {
                                Id = houseCount, Grid = shape
                            });
                            shape.ClassId = string.Format("house_{0}_{1}", i, j);
                            var tabGestureOrganiser1 = new TapGestureRecognizer();
                            tabGestureOrganiser1.Tapped += EdgeClicked;
                            shape.GestureRecognizers.Add(tabGestureOrganiser1);
                        }
                        else
                        {
                            shape.ClassId = string.Format("vertex{0}{1}", i, j);
                        }
                        continue;
                    }
                    if (start)
                    {
                        if (i < last - 1)
                        {
                            if (i % 2 == 0)
                            {
                                id = ((i / 2) * (4 * count) + j).ToString();
                            }
                            else
                            {
                                id = ((i / 2) * (4 * count) + 4).ToString();
                            }
                        }
                        else
                        {
                            id = id = (((i - 1) / 2) * (4 * count) + 3).ToString();
                        }
                        start = false;
                    }
                    else
                    {
                        var splitted = id.Split('_');
                        id = (Convert.ToInt32(splitted[splitted.Length - 1]) + 4).ToString();
                    }
                    if (i > 0 && j > 0 && i < last - 1)
                    {
                        if (j < last - 1)
                        {
                            if (i % 2 != 0)
                            {
                                id = (Convert.ToInt32(id) - 6).ToString() + "_" + id;
                            }
                            else
                            {
                                id = (Convert.ToInt32(id) - (4 * count - 2)).ToString() + "_" + id;
                            }
                        }
                        else
                        {
                            id = (Convert.ToInt32(id) - 6).ToString();
                        }
                    }
                    shape = new Xamarin.Forms.BoxView()
                    {
                        BackgroundColor = edgeDefaultColor
                    };
                    shape.ClassId = "_" + id;
                    var ids = id.Split('_');
                    foreach (var item in ids)
                    {
                        var edge = new Edge()
                        {
                            Shape = shape, Name = shape.ClassId
                        };
                        shapeDict.Add(item, edge);
                    }
                    var tabGestureOrganiser = new TapGestureRecognizer();
                    tabGestureOrganiser.Tapped += EdgeClicked;
                    shape.GestureRecognizers.Add(tabGestureOrganiser);
                    Xamarin.Forms.Grid.SetRow(shape, i);
                    Xamarin.Forms.Grid.SetColumn(shape, j);
                    grid.Children.Add(shape);
                }
            }
            MapHousesToEdges();
            if (moveFirst && !ClasicGameSetting.Is2Players)
            {
                CompMove();
            }
        }
コード例 #33
0
        public BoxViewHandler(NativeComponentRenderer renderer, XF.BoxView boxViewControl) : base(renderer, boxViewControl)
        {
            BoxViewControl = boxViewControl ?? throw new ArgumentNullException(nameof(boxViewControl));

            Initialize(renderer);
        }
コード例 #34
0
                btn1 = new Button()
                {
                    Text = "расстаять"
                };
                btn1.Clicked += Btn1_Clicked;;
                AbsoluteLayout.SetLayoutBounds(btn1, new Rectangle(0.1, 0.7, 110, 50));
                AbsoluteLayout.SetLayoutFlags(btn1, AbsoluteLayoutFlags.PositionProportional);

                btn2 = new Button()
                {
                    Text = "слепить"
                };
                btn2.Clicked += Btn2_Clicked1;;
                AbsoluteLayout.SetLayoutBounds(btn2, new Rectangle(0.1, 0.8, 110, 50));
                AbsoluteLayout.SetLayoutFlags(btn2, AbsoluteLayoutFlags.PositionProportional);

                btn3 = new Button()
                {
                    Text = "random"
                };
                btn3.Clicked += Btn3_Clicked1;;
                AbsoluteLayout.SetLayoutBounds(btn3, new Rectangle(0.1, 0.9, 110, 50));
                AbsoluteLayout.SetLayoutFlags(btn3, AbsoluteLayoutFlags.PositionProportional);

                btn4 = new Button()
                {
                    Text = "красио растаять"
                };
                btn4.Clicked += Btn4_Clicked1;;
                AbsoluteLayout.SetLayoutBounds(btn4, new Rectangle(0.1, 0.6, 110, 60));
                AbsoluteLayout.SetLayoutFlags(btn4, AbsoluteLayoutFlags.PositionProportional);


                golova = new Xamarin.Forms.BoxView {
                    Color = Color.AliceBlue, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(golova, new Rectangle(0.5, 0.31, 70, 70));
                AbsoluteLayout.SetLayoutFlags(golova, AbsoluteLayoutFlags.PositionProportional);

                akrug = new Xamarin.Forms.BoxView {
                    Color = Color.AliceBlue, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(akrug, new Rectangle(0.5, 0.4, 90, 90));
                AbsoluteLayout.SetLayoutFlags(akrug, AbsoluteLayoutFlags.PositionProportional);

                bkrug = new Xamarin.Forms.BoxView {
                    Color = Color.AliceBlue, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(bkrug, new Rectangle(0.5, 0.5, 110, 110));
                AbsoluteLayout.SetLayoutFlags(bkrug, AbsoluteLayoutFlags.PositionProportional);

                asljapa = new Xamarin.Forms.BoxView {
                    Color = Color.Black
                };
                AbsoluteLayout.SetLayoutBounds(asljapa, new Rectangle(0.5, 0.21, 40, 45));
                AbsoluteLayout.SetLayoutFlags(asljapa, AbsoluteLayoutFlags.PositionProportional);

                bsljapa = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(bsljapa, new Rectangle(0.5, 0.26, 60, 8));
                AbsoluteLayout.SetLayoutFlags(bsljapa, AbsoluteLayoutFlags.PositionProportional);

                glaz = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(glaz, new Rectangle(0.52, 0.3, 8, 8));
                AbsoluteLayout.SetLayoutFlags(glaz, AbsoluteLayoutFlags.PositionProportional);

                glaza = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(glaza, new Rectangle(0.47, 0.3, 8, 8));
                AbsoluteLayout.SetLayoutFlags(glaza, AbsoluteLayoutFlags.PositionProportional);

                morkovka = new Xamarin.Forms.BoxView {
                    Color = Color.Orange, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(morkovka, new Rectangle(0.5, 0.33, 9, 9));
                AbsoluteLayout.SetLayoutFlags(morkovka, AbsoluteLayoutFlags.PositionProportional);

                apugovka = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(apugovka, new Rectangle(0.5, 0.38, 9, 9));
                AbsoluteLayout.SetLayoutFlags(apugovka, AbsoluteLayoutFlags.PositionProportional);

                bpugovka = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(bpugovka, new Rectangle(0.5, 0.41, 9, 9));
                AbsoluteLayout.SetLayoutFlags(bpugovka, AbsoluteLayoutFlags.PositionProportional);

                cpugovka = new Xamarin.Forms.BoxView {
                    Color = Color.Black, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(cpugovka, new Rectangle(0.5, 0.44, 9, 9));
                AbsoluteLayout.SetLayoutFlags(cpugovka, AbsoluteLayoutFlags.PositionProportional);

                ruk = new Xamarin.Forms.BoxView {
                    Color = Color.Brown, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(ruk, new Rectangle(0.22, 0.38, 80, 8));
                AbsoluteLayout.SetLayoutFlags(ruk, AbsoluteLayoutFlags.PositionProportional);

                ruki = new Xamarin.Forms.BoxView {
                    Color = Color.Brown, CornerRadius = 100
                };
                AbsoluteLayout.SetLayoutBounds(ruki, new Rectangle(0.78, 0.38, 80, 8));
                AbsoluteLayout.SetLayoutFlags(ruki, AbsoluteLayoutFlags.PositionProportional);



                abs.Children.Add(golova);
                abs.Children.Add(akrug);
                abs.Children.Add(bkrug);
                abs.Children.Add(asljapa);
                abs.Children.Add(bsljapa);
                abs.Children.Add(glaz);
                abs.Children.Add(glaza);
                abs.Children.Add(apugovka);
                abs.Children.Add(bpugovka);
                abs.Children.Add(cpugovka);
                abs.Children.Add(ruk);
                abs.Children.Add(ruki);
                abs.Children.Add(morkovka);
                abs.Children.Add(btn1);
                abs.Children.Add(btn2);
                abs.Children.Add(btn3);
                abs.Children.Add(btn4);

                Content = abs;
            }