Ejemplo n.º 1
0
 protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
 {
     base.OnElementChanged(e);
     if (Control == null || e.OldElement != null || this.Element == null)
     {
         return;
     }
     Control.Background = null;
     _appSearchBar      = (this.Element as AppSearchBar);
     UpdatePadding(_appSearchBar);
     UpdateTextAlighnment(_appSearchBar);
     UpdateBackground(_appSearchBar);
 }
Ejemplo n.º 2
0
 protected override void OnElementChanged(ElementChangedEventArgs <SearchBar> e)
 {
     base.OnElementChanged(e);
     if (Control == null || e.OldElement != null || this.Element == null)
     {
         return;
     }
     //Control.SearchBarStyle = UISearchBarStyle.Minimal;
     //Control.BarTintColor = UIColor.Clear;
     _appSearchBar = (this.Element as AppSearchBar);
     UpdateBorderWidth(_appSearchBar);
     UpdateBorderColor(_appSearchBar);
     UpdateBorderRadius(_appSearchBar);
     Control.ClipsToBounds = true;
 }
Ejemplo n.º 3
0
        private void UpdateBackground(AppSearchBar searchBar)
        {
            // creating gradient drawable for the curved background  
            var _gradientBackground = new GradientDrawable();

            _gradientBackground.SetShape(ShapeType.Rectangle);
            _gradientBackground.SetColor(searchBar.BackgroundColor.ToAndroid());

            // Thickness of the stroke line  
            _gradientBackground.SetStroke(searchBar.BorderWidth, searchBar.BorderColor.ToAndroid());

            // Radius for the curves  
            _gradientBackground.SetCornerRadius(DpToPixels(this.Context, Convert.ToSingle(searchBar.CornerRadius)));

            // set the background of the   
            Control.SetBackground(_gradientBackground);
        }
Ejemplo n.º 4
0
 private void UpdateBorderRadius(AppSearchBar searchBar)
 {
     Control.Layer.CornerRadius = (nfloat)searchBar.CornerRadius;
 }
Ejemplo n.º 5
0
 private void UpdateBorderColor(AppSearchBar searchBar)
 {
     Control.Layer.BorderColor = searchBar.BorderColor.ToUIColor().CGColor;
 }
Ejemplo n.º 6
0
 private void UpdateBorderWidth(AppSearchBar searchBar)
 {
     Control.Layer.BorderWidth = searchBar.BorderWidth;
 }
Ejemplo n.º 7
0
 private void UpdatePadding(AppSearchBar searchBar)
 {
     // Set padding for the internal text from border  
     Control.SetPadding((int)DpToPixels(this.Context, Convert.ToSingle(12)), Control.PaddingTop, (int)DpToPixels(this.Context, Convert.ToSingle(12)), Control.PaddingBottom);
 }