Exemple #1
0
 void intilizeSearchNotKitkat()
 {
     searchBar = new MySearchBar {
         TextColor         = ApplicationStyle.TextColor,
         PlaceholderColor  = ApplicationStyle.LabelColor,
         BackgroundColor   = ApplicationStyle.LineColor,
         HorizontalOptions = LayoutOptions.FillAndExpand,
         HeightRequest     = 43,
         WidthRequest      = 100,
         Placeholder       = "Поиск по каталогу",
     };
     searchBar.TextChanged += (sender, e) => {
         if (SearchProduct != null)
         {
             SearchProduct(sender, e);
         }
     };
 }
Exemple #2
0
        StackLayout intilizeSearchNotKitkat()
        {
            MySearchBar searchBar = new MySearchBar {
                BackgroundColor   = ApplicationStyle.LineColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                PlaceholderColor  = ApplicationStyle.LabelColor,
                Placeholder       = "Поиск по каталогу",
                IsEnabled         = false,
                //HorizontalTextAlignment = TextAlignment.Center,
            };


            StackLayout searchLayout = new StackLayout {
                Spacing         = 0,
                BackgroundColor = ApplicationStyle.LineColor,
                Children        =
                {
                    searchBar,
                    //					layoutImg,
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                searchBar.HeightRequest = heightSearch;
                //searchBar.HeightRequest = heightSearch - (7 * 2);
                //searchLayout.Padding = new Thickness (0, 7);
            }
            else
            {
                searchBar.HeightRequest = heightSearch;
            }

            TapGestureRecognizer tapSearch = new TapGestureRecognizer();

            tapSearch.Tapped += OnSearchClick;
            searchBar.GestureRecognizers.Add(tapSearch);
            searchLayout.GestureRecognizers.Add(tapSearch);
            searchBar.Focused += OnSearchClick;

            return(searchLayout);
        }