コード例 #1
0
ファイル: EffectPage.cs プロジェクト: XnainA/ColorConverter
        public EffectPage(Color clr)
        {
            BindingContext       = new ColorConverterViewModel(this.Navigation);
            this.BackgroundImage = "Bg.png";

            imgMain = new Image
            {
                WidthRequest    = w / 2,
                HeightRequest   = w / 2,
                BackgroundColor = clr
            };
            imgMain.SetBinding(Image.SourceProperty, "Effect");


            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Spacing           = h / 10,
                Children          =
                {
                    imgMain,
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Spacing           = w / 10,
                        Children          =
                        {
                            Effect("Img1.png", "1","Tap1"),
                            Effect("Img2.png", "2","Tap2"),
                            Effect("Img3.png", "3","Tap3")
                        }
                    },                        new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Spacing           = w / 10,
                        Children          =
                        {
                            Effect("Img4.png", "4","Tap4"),
                            Effect("Img5.png", "5","Tap5"),
                            Effect("Img6.png", "6","Tap6")
                        }
                    }
                }
            };
        }
コード例 #2
0
        public ColorConverterPage()
        {
            BindingContext       = new ColorConverterViewModel(this.Navigation);
            this.BackgroundImage = "Bg.png";
            btnHtoR = new Button
            {
                Text            = "Convert Hexa to RGB",
                TextColor       = Colors.CCBtn.ToFormsColor(),
                BackgroundColor = Color.White,
                Command         = ViewModel.HEXtoRGB
            };
            btnRtoH = new Button
            {
                Text            = "Convert RGB to Hexa",
                TextColor       = Colors.CCBtn.ToFormsColor(),
                BackgroundColor = Color.White,
                Command         = ViewModel.RGBtoHEX
            };

            lblHexa = new Label
            {
                Text      = "Hexa Color",
                FontSize  = h / 22,
                TextColor = Colors.CCBtn.ToFormsColor(),
                YAlign    = TextAlignment.Start
            };
            CustomEntry txt =

                txtHexa = new CustomEntry(new CustomEntryParams
            {
                MaxLength = 6
            })
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };

            txtHexa.SetBinding(Entry.TextProperty, "Hexa");
            boxColor = new BoxView
            {
                BackgroundColor = Color.Black,
                WidthRequest    = w / 3,
                HeightRequest   = w / 3
            };
            boxColor.SetBinding(BoxView.ColorProperty, "BoxColor");
            var boxColortap = new TapGestureRecognizer(OnboxColorTapped);

            boxColortap.NumberOfTapsRequired = 1;
            boxColor.IsEnabled = true;
            boxColor.GestureRecognizers.Clear();
            boxColor.GestureRecognizers.Add(boxColortap);

            Content = new StackLayout
            {
                Padding           = new Thickness(w / 10, w / 10, w / 10, w / 10),
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = w / 10,
                Children          =
                {
                    GenEventTablelGrid(),
                    btnRtoH,
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            lblHexa, txtHexa
                        }
                    },
                    btnHtoR,
                    boxColor
                }
            };
        }