void UpdateImage()
        {
            if (_disposed || _renderer == null || _element == null)
            {
                return;
            }

            AButton view = View;

            if (view == null)
            {
                return;
            }

            ImageSource elementImage = _element.ImageSource;

            if (elementImage == null || elementImage.IsEmpty)
            {
                view.SetCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
                return;
            }

            // No text, so no need for relative position; just center the image
            // There's no option for just plain-old centering, so we'll use Top
            // (which handles the horizontal centering) and some tricksy padding (in OnLayout)
            // to handle the vertical centering
            var layout = string.IsNullOrEmpty(_element.Text) ? _imageOnlyLayout : _element.ContentLayout;

            if (_maintainLegacyMeasurements)
            {
                view.CompoundDrawablePadding = (int)layout.Spacing;
            }
            else
            {
                view.CompoundDrawablePadding = (int)Context.ToPixels(layout.Spacing);
            }

            Drawable existingImage = null;
            var      images        = TextViewCompat.GetCompoundDrawablesRelative(view);

            for (int i = 0; i < images.Length; i++)
            {
                if (images[i] != null)
                {
                    existingImage = images[i];
                    break;
                }
            }

            if (_renderer is IVisualElementRenderer visualElementRenderer)
            {
                visualElementRenderer.ApplyDrawableAsync(Button.ImageSourceProperty, Context, image =>
                {
                    if (image == existingImage)
                    {
                        return;
                    }

                    switch (layout.Position)
                    {
                    case Button.ButtonContentLayout.ImagePosition.Top:
                        TextViewCompat.SetCompoundDrawablesRelativeWithIntrinsicBounds(view, null, image, null, null);
                        break;

                    case Button.ButtonContentLayout.ImagePosition.Right:
                        TextViewCompat.SetCompoundDrawablesRelativeWithIntrinsicBounds(view, null, null, image, null);
                        break;

                    case Button.ButtonContentLayout.ImagePosition.Bottom:
                        TextViewCompat.SetCompoundDrawablesRelativeWithIntrinsicBounds(view, null, null, null, image);
                        break;

                    default:
                        // Defaults to image on the left
                        TextViewCompat.SetCompoundDrawablesRelativeWithIntrinsicBounds(view, image, null, null, null);
                        break;
                    }

                    if (_hasLayoutOccurred)
                    {
                        _element?.InvalidateMeasureNonVirtual(InvalidationTrigger.MeasureChanged);
                    }
                });
            }
        }