Beispiel #1
0
        public Filter()
        {
            InitializeComponent();

            //CustomNavigationPage.SetTitlePosition(this, CustomNavigationPage.TitleAlignment.Center);
            //CustomNavigationPage.SetTitleFont(this, Font.SystemFontOfSize(NamedSize.Large));


            BindingContext = this;

            Items.Add(new Item {
                Name = "DISTANCE", TextColor = Color.Red
            });
            Items.Add(new Item {
                Name = "MALL"
            });
            Items.Add(new Item {
                Name = "RETAILER"
            });


            GenderItems.Add(new Item {
                GenderName = "Within a km", img = ImageSource.FromFile("unselected.png")
            });
            GenderItems.Add(new Item {
                GenderName = "Within 5 km", img = ImageSource.FromFile("unselected.png")
            });
            GenderItems.Add(new Item {
                GenderName = "Within 10 km", img = ImageSource.FromFile("unselected.png")
            });
            GenderItems.Add(new Item {
                GenderName = "Within 15 km", img = ImageSource.FromFile("unselected.png")
            });
            GenderItems.Add(new Item {
                GenderName = "Any distance", img = ImageSource.FromFile("unselected.png")
            });

            SizeItems.Add(new Item {
                SizeName = "Select CityWalk"
            });


            // StyleItems.Add(new Item { StyleName = "Casual" });



            //  dataItem.TextColor = Color.Red;
        }
        void SelectAction(object obj)
        {
            var tag = (TagViewModel)obj;

            tag.TextColor       = Color.White;
            tag.BackgroundColor = Color.FromHex("#174163");
            IList <TagViewModel> list = null;

            switch ((string)tag.Parameters)
            {
            case "jobs":
                list         = JobItems.Where(d => d.Text != tag.Text).ToList();
                _selectedJob = tag;
                break;

            case "ages":
                list         = AgeItems.Where(d => d.Text != tag.Text).ToList();
                _selectedAge = tag;
                break;

            case "genders":
                list            = GenderItems.Where(d => d.Text != tag.Text).ToList();
                _selectedGender = tag;
                if (_selectedGender.Text.Equals("Autre"))
                {
                    GenderIsVisible = true;
                }
                else
                {
                    GenderIsVisible = false;
                }
                break;
            }

            if (list?.Count > 0)
            {
                foreach (var elt in list)
                {
                    elt.TextColor       = Color.FromHex("#174163");
                    elt.BackgroundColor = Color.White;
                }
            }
        }