private void CreatShadowOnWhiteBackground(CoreAnimation.CALayer layer) { layer.ShadowColor = UIColor.DarkGray.CGColor; layer.ShadowOffset = new CoreGraphics.CGSize(1, 2); layer.ShadowOpacity = 1; layer.ShadowRadius = 1; }
protected override void OnElementChanged(ElementChangedEventArgs <Picker> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } var element = (ImagePicker)this.Element; var textfield = this.Control; if (this.Control != null && this.Element != null && !string.IsNullOrEmpty(element.DropDownImage)) { textfield.RightViewMode = UITextFieldViewMode.Always; textfield.RightView = GetImageView(element.DropDownImage, 15, 15); textfield.BorderStyle = UITextBorderStyle.None; // border.frame = CGRect(x: 0, y: self.frame.size.height - width, width: self.frame.size.width, height: self.frame.size.height) var frame = this.Frame.Width; var bottomBorder = new CoreAnimation.CALayer() { Frame = new CoreGraphics.CGRect(5.0, element.HeightRequest - 10, element.WidthRequest - 5.0, 1.0), BorderWidth = 2.0f, BorderColor = Xamarin.Forms.Color.Black.ToCGColor(), }; textfield.Layer.AddSublayer(bottomBorder); textfield.Layer.MasksToBounds = true; textfield.AttributedPlaceholder = new NSAttributedString(textfield.AttributedPlaceholder.Value, foregroundColor: element.PlaceHolderColor.ToUIColor()); } }
public override void LayoutSublayersOfLayer(CoreAnimation.CALayer layer) { base.LayoutSublayersOfLayer(layer); if (this.Layer == layer) { this.LayoutShape(); } }
private void AddBottomBorder() { var border = new CoreAnimation.CALayer(); var width = 1f; border.BorderColor = UIColor.LightGray.CGColor; border.Frame = new CGRect(0, Frame.Size.Height - width, Frame.Size.Width, Frame.Size.Height); border.BorderWidth = width; Layer.AddSublayer(border); Layer.MasksToBounds = true; }
void InitializeControls() { View.BackgroundColor = UIColor.Clear; _internalView = new UIView(); _text = new UILabel(new CGRect(0, 0, 320/2, 44)); _text.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; _text.BackgroundColor = HeaderBackgroundColor; _text.TextColor = HeaderTextColor; _text.Text = Text; _text.LineBreakMode = UILineBreakMode.WordWrap; _text.Lines = 0; _cancelButton = UIButton.FromType(UIButtonType.System); _cancelButton.SetTitleColor(HeaderTextColor, UIControlState.Normal); _cancelButton.BackgroundColor = UIColor.Clear; _cancelButton.SetTitle(CancelButtonText, UIControlState.Normal); _cancelButton.TouchUpInside += CancelButtonTapped; CoreAnimation.CALayer bottomBorder = new CoreAnimation.CALayer(); bottomBorder.BorderColor = UIColor.Gray.CGColor; bottomBorder.BorderWidth = 1; bottomBorder.Frame = new CGRect(-1, 30, 200, 1); _cancelButton.Layer.AddSublayer (bottomBorder); _internalView.BackgroundColor = HeaderBackgroundColor; _internalView.AddSubview(_text); _internalView.AddSubview (_cancelButton); Add(_internalView); _dismissRecognizer = new UITapGestureRecognizer (OnTapOutside); //_dismissRecognizer.NumberOfTapsRequired = 1u; //_dismissRecognizer.CancelsTouchesInView = false; View.AddGestureRecognizer (_dismissRecognizer); _swipeRecognizerLeft = new UISwipeGestureRecognizer (OnSwipeLeft){ Direction = UISwipeGestureRecognizerDirection.Left }; View.AddGestureRecognizer (_swipeRecognizerLeft); }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); line = null; if (Control == null || e.NewElement == null) { return; } Control.BorderStyle = UIKit.UITextBorderStyle.None; line = new CoreAnimation.CALayer(); line.BorderColor = Color.White.ToCGColor(); line.BackgroundColor = Color.White.ToCGColor(); line.Frame = new CoreGraphics.CGRect(0, Frame.Height / 1.25, Frame.Width * 2, 1f); Control.Layer.AddSublayer(line); }
public CustomSearchField() { TranslatesAutoresizingMaskIntoConstraints = false; Cell = cell = new SearchFieldCell(this); WantsLayer = true; var internalLayer = new CoreAnimation.CALayer(); internalLayer.BorderWidth = 1; internalLayer.BorderColor = NSColor.FromRgba(red: 0.75f, green: 0.75f, blue: 0.75f, 0.45f).CGColor; internalLayer.Frame = new CGRect(1, 0, DefaultWidth + 2, DefaultHeight); internalLayer.CornerRadius = 2; Layer.AddSublayer(internalLayer); Font = NSFont.SystemFontOfSize(SearchFontSize, NSFontWeight.Thin); //default size needs to be changed before change cell WidthAnchor.ConstraintEqualToConstant(DefaultWidth).Active = true; HeightAnchor.ConstraintEqualToConstant(DefaultHeight).Active = true; }
internal static void UpdateLayerBorder(this CoreAnimation.CALayer layer, IButtonStroke?stroke) { if (stroke == null) { return; } if (stroke.StrokeColor != null) { layer.BorderColor = stroke.StrokeColor.ToCGColor(); } if (stroke.StrokeThickness >= 0) { layer.BorderWidth = (float)stroke.StrokeThickness; } if (stroke.CornerRadius >= 0) { layer.CornerRadius = stroke.CornerRadius; } }
public override void LayoutSublayersOfLayer(CoreAnimation.CALayer layer) { base.LayoutSublayersOfLayer(layer); }
public override void DrawLayer(CoreAnimation.CALayer layer, CoreGraphics.CGContext context) { AddView(buttonView); }