void UpdateBackground() { _renderer.ApplyNativeImageAsync(Page.BackgroundImageSourceProperty, bgImage => { if (bgImage != null) { Layer.BackgroundColor = NSColor.FromPatternImage(bgImage).CGColor; } else { Brush background = _renderer.Element.Background; if (!Brush.IsNullOrEmpty(background)) { _renderer.NativeView.UpdateBackground(_renderer.Element.Background); } else { Color bgColor = _renderer.Element.BackgroundColor; Layer.BackgroundColor = bgColor.IsDefault ? ColorExtensions.WindowBackgroundColor.CGColor : bgColor.ToCGColor(); } } }); }
internal static Task ApplyNativeImageAsync(this IVisualElementRenderer renderer, BindableProperty imageSourceProperty, Action <Pixbuf> onSet, Action <bool> onLoading = null, CancellationToken cancellationToken = default(CancellationToken)) { return(renderer.ApplyNativeImageAsync(null, imageSourceProperty, onSet, onLoading, cancellationToken)); }