コード例 #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);
 }
コード例 #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;
 }
コード例 #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);
        }
コード例 #4
0
 private void UpdateBorderRadius(AppSearchBar searchBar)
 {
     Control.Layer.CornerRadius = (nfloat)searchBar.CornerRadius;
 }
コード例 #5
0
 private void UpdateBorderColor(AppSearchBar searchBar)
 {
     Control.Layer.BorderColor = searchBar.BorderColor.ToUIColor().CGColor;
 }
コード例 #6
0
 private void UpdateBorderWidth(AppSearchBar searchBar)
 {
     Control.Layer.BorderWidth = searchBar.BorderWidth;
 }
コード例 #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);
 }