Beispiel #1
0
        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();
                    }
                }
            });
        }
Beispiel #2
0
 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));
 }