Ejemplo n.º 1
0
        private DataTemplate GetDataTemplate()
        {
            return(new DataTemplate(() =>
            {
                Label author = new CustomLabel();
                author.SetBinding(Label.TextProperty, "Author");
                author.TextColor = Props.ButtonInfoPageColor;
                author.FontSize = 20;
                author.FontFamily = UIUtils.FONT_BEBAS_REGULAR;
                author.Margin = new Thickness(20, 0, 20, 0);

                var ratingLayout = new RatingLayout();
                ratingLayout.HeightRequest = 20;
                ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating");
                ratingLayout.HorizontalOptions = LayoutOptions.EndAndExpand;
                ratingLayout.Margin = new Thickness(0, 0, 20, 0);

                var top = new StackLayout {
                    Orientation = StackOrientation.Horizontal,
                    Margin = new Thickness(0, 20, 0, 0),
                    Children =
                    {
                        author,
                        ratingLayout
                    }
                };

                var review = new CustomLabel();
                review.SetBinding(Label.TextProperty, "Description");
                review.TextColor = Color.Black;
                review.HorizontalOptions = LayoutOptions.Fill;
                review.FontFamily = UIUtils.FONT_SFUIDISPLAY_LIGHT;
                review.Margin = new Thickness(20, 0, 20, 0);

                var layout = new StackLayout();
                layout.Children.Add(top);
                layout.Children.Add(review);
                var viewCell = new ViewCell();
                viewCell.View = layout;
                return viewCell;
            }));
        }
Ejemplo n.º 2
0
        private DataTemplate GetDataTemplate()
        {
            return(new DataTemplate(() =>
            {
                CustomLabel address = new CustomLabel();
                address.SetBinding(Label.TextProperty, "Address");
                address.LetterSpacing = 0.15f;
                address.FontSize = 14;
                address.TextColor = Color.FromHex("#4A4A4A");
                address.LineBreakMode = LineBreakMode.TailTruncation;
                address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;
                address.Margin = new Thickness(10, 0, 5, 0);

                CustomLabel mainText = new CustomLabel();
                mainText.SetBinding(Label.TextProperty, "BusinessName");
                mainText.LetterSpacing = 0.25f;
                mainText.FontSize = 21;
                mainText.TextColor = Color.FromHex("#4A4A4A");
                mainText.FontFamily = UIUtils.FONT_BEBAS_BOOK;
                mainText.Margin = new Thickness(5, 0, 0, 0);

                CustomLabel price = new CustomLabel();
                price.SetBinding(Label.TextProperty, "Price");
                price.LetterSpacing = 0.1f;
                price.FontSize = 14;
                price.TextColor = Color.FromHex("#4A4A4A");
                price.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;

                CustomLabel nameMua = new CustomLabel();
                nameMua.SetBinding(Label.TextProperty, "FullName");
                nameMua.LetterSpacing = 0.15f;
                nameMua.FontSize = 16;
                nameMua.TextColor = Color.FromHex("#4A4A4A");
                nameMua.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;
                nameMua.Margin = new Thickness(5, 0, 0, 0);

                var imageBackground = new Image();
                imageBackground.SetBinding(UIUtils.TagProperty, "Pictures");
                imageBackground.SetValue(UIUtils.Tag2Property, 0);
                imageBackground.Aspect = Aspect.AspectFill;
                imageBackground.SetBinding(Image.SourceProperty, "PictureSourse");

                var leftImg = new Image();
                leftImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png");
                leftImg.HeightRequest = 40;
                leftImg.WidthRequest = leftImg.HeightRequest;
                leftImg.GestureRecognizers.Add(new TapGestureRecognizer((v) =>
                {
                    ShowNextBgImage(imageBackground, -1);
                }));

                var rightImg = new Image();
                rightImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png");
                rightImg.Rotation = 180;
                rightImg.HeightRequest = 40;
                rightImg.WidthRequest = rightImg.HeightRequest;
                rightImg.GestureRecognizers.Add(new TapGestureRecognizer((v) =>
                {
                    ShowNextBgImage(imageBackground, 1);
                }));

                var location = new Image();
                location.Source = ImageSource.FromResource("TiroApp.Images.location_black.png");
                location.HeightRequest = 20;
                //location.WidthRequest = rightImg.HeightRequest;

                var ratingLayout = new RatingLayout();
                ratingLayout.HeightRequest = 20;
                ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating");

                var infoImage = new Image();
                infoImage.Source = ImageSource.FromResource("TiroApp.Images.muaListRectangle.png");
                infoImage.Aspect = Aspect.Fill;
                //infoImage.HeightRequest = 70;
                //infoImage.WidthRequest = App.ScreenWidth;

                //var infoFrame = new Frame();
                //infoFrame.Content = infoImage;
                //infoFrame.OutlineColor = Color.FromHex("#979797");

                var layout = new RelativeLayout();
                layout.Children.Add(imageBackground, Constraint.Constant(0), Constraint.Constant(0)
                                    , Constraint.RelativeToParent(p => p.Width)
                                    , Constraint.RelativeToParent(p => p.Height - 70));
                layout.Children.Add(leftImg
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(leftImg).Width - 10)
                                    , Constraint.RelativeToParent(p => (p.Height - 70) / 2 - Utils.GetControlSize(leftImg).Height / 2));
                layout.Children.Add(rightImg
                                    , Constraint.Constant(10)
                                    , Constraint.RelativeToParent(p => (p.Height - 70) / 2 - Utils.GetControlSize(rightImg).Height / 2));
                layout.Children.Add(infoImage
                                    , Constraint.Constant(0)
                                    , Constraint.RelativeToParent(p => p.Height - 70)
                                    , Constraint.RelativeToParent(p => p.Width)
                                    , Constraint.Constant(75));
                layout.Children.Add(mainText
                                    , Constraint.Constant(3)
                                    , Constraint.RelativeToParent(p => p.Height - 65));
                layout.Children.Add(nameMua
                                    , Constraint.Constant(3)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(nameMua).Height - Utils.GetControlSize(location).Height - 4));
                layout.Children.Add(location
                                    , Constraint.Constant(8)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(location).Height - 2));
                layout.Children.Add(address
                                    , Constraint.RelativeToParent(p => Utils.GetControlSize(location).Width + 4)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(address).Height - 2)
                                    , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Width)
                                    , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Height));
                layout.Children.Add(ratingLayout
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 5)
                                    , Constraint.RelativeToParent(p => p.Height - 65));
                layout.Children.Add(price
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(price).Width - 5)
                                    , Constraint.RelativeToParent(p => p.Height - 40));
                layout.Margin = new Thickness(0, 0, 0, 25);
                var viewCell = new ViewCell();
                viewCell.View = layout;
                return viewCell;
            }));
        }
Ejemplo n.º 3
0
        private DataTemplate GetDataTemplate()
        {
            return(new DataTemplate(() =>
            {
                Label address = new CustomLabel();
                address.SetBinding(Label.TextProperty, "Address");
                address.TextColor = Color.White;
                address.LineBreakMode = LineBreakMode.TailTruncation;
                address.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;

                Label mainText = new CustomLabel();
                mainText.SetBinding(Label.TextProperty, "BusinessName");
                mainText.FontSize = 21;
                mainText.TextColor = Color.White;
                mainText.FontFamily = UIUtils.FONT_BEBAS_BOOK;

                Label price = new CustomLabel();
                price.SetBinding(Label.TextProperty, "Price");
                price.TextColor = Color.White;
                price.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;

                Label nameMua = new CustomLabel();
                nameMua.SetBinding(Label.TextProperty, "FullName");
                nameMua.TextColor = Color.White;
                nameMua.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR;

                var imageBackground = new Image();
                imageBackground.SetBinding(UIUtils.TagProperty, "Pictures");
                imageBackground.SetValue(UIUtils.Tag2Property, 0);
                imageBackground.Aspect = Aspect.AspectFill;
                imageBackground.SetBinding(Image.SourceProperty, "PictureSourse");

                var leftImg = new Image();
                leftImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png");
                leftImg.HeightRequest = 40;
                leftImg.WidthRequest = leftImg.HeightRequest;
                leftImg.GestureRecognizers.Add(new TapGestureRecognizer((v) =>
                {
                    ShowNextBgImage(imageBackground, -1);
                }));

                var rightImg = new Image();
                rightImg.Source = ImageSource.FromResource("TiroApp.Images.goToMua.png");
                rightImg.Rotation = 180;
                rightImg.HeightRequest = 40;
                rightImg.WidthRequest = rightImg.HeightRequest;
                rightImg.GestureRecognizers.Add(new TapGestureRecognizer((v) =>
                {
                    ShowNextBgImage(imageBackground, 1);
                }));

                var location = new Image();
                location.Source = ImageSource.FromResource("TiroApp.Images.location.png");
                location.HeightRequest = 20;
                location.WidthRequest = rightImg.HeightRequest;

                var ratingLayout = new RatingLayout();
                ratingLayout.HeightRequest = 20;
                ratingLayout.SetBinding(RatingLayout.RatingProperty, "Rating");

                var layout = new RelativeLayout();
                layout.BackgroundColor = Color.Black;//TEMP
                layout.Children.Add(imageBackground, Constraint.Constant(0), Constraint.Constant(0)
                                    , Constraint.RelativeToParent(p => p.Width)
                                    , Constraint.RelativeToParent(p => p.Height));
                layout.Children.Add(price
                                    , Constraint.Constant(10)
                                    , Constraint.Constant(10));
                layout.Children.Add(mainText
                                    , Constraint.Constant(10)
                                    , Constraint.RelativeToParent(p => p.Height - p.Height / 3 - Utils.GetControlSize(mainText).Height + 20));
                layout.Children.Add(nameMua
                                    , Constraint.Constant(10)
                                    , Constraint.RelativeToParent(p => p.Height - p.Height / 3 + 20));
                layout.Children.Add(leftImg
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(leftImg).Width - 10)
                                    , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(leftImg).Height / 2));
                layout.Children.Add(rightImg
                                    , Constraint.Constant(10)
                                    , Constraint.RelativeToParent(p => p.Height / 2 - Utils.GetControlSize(rightImg).Height / 2));
                layout.Children.Add(location
                                    , Constraint.Constant(0)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(location).Height - 15));
                layout.Children.Add(address
                                    , Constraint.Constant(40)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(address).Height - 15)
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 60)
                                    , Constraint.RelativeToParent(p => Utils.GetControlSize(address).Height));
                layout.Children.Add(ratingLayout
                                    , Constraint.RelativeToParent(p => p.Width - Utils.GetControlSize(ratingLayout).Width - 15)
                                    , Constraint.RelativeToParent(p => p.Height - Utils.GetControlSize(ratingLayout).Height - 15));
                var viewCell = new ViewCell();
                viewCell.View = layout;
                return viewCell;
            }));
        }