Ejemplo n.º 1
0
 private void MySearchBarOnTextChanged(object sender, TextChangedEventArgs textChangedEventArgs)
 {
     if (string.IsNullOrEmpty(textChangedEventArgs.NewTextValue))
     {
         vm.Ads(CategoryPicker.SelectedIndex);
     }
 }
Ejemplo n.º 2
0
        public Home()
        {
            vm             = new HomeViewModel();
            BindingContext = vm;
            InitializeComponent();
            Title = "Advertisement platform";
            CategoryPicker.Title = "Category Setting Default All";
            CategoryPicker.Items.Add("All");
            CategoryPicker.Items.Add("Companies");
            CategoryPicker.Items.Add("Recruits");
            CategoryPicker.Items.Add("RentRooms");
            CategoryPicker.Items.Add("Products");
            CategoryPicker.Items.Add("PersonalInfo");

            CategoryPicker.SelectedIndexChanged += (sender, args) =>
            {
                var search        = string.IsNullOrEmpty(vm.SearchText)?"none":vm.SearchText.Trim();
                var categoryIndex = CategoryPicker.SelectedIndex;
                vm.Ads(categoryIndex, search);
            };
            SearchBar.TextChanged += MySearchBarOnTextChanged;
        }