protected override void OnDraw(Canvas canvas)
        {
            base.OnDraw(canvas);

            if (Control.GetCompoundDrawables() != null && BaseElement.CenterImage)
            {
                var text            = Control.Text;
                int iconTextSpacing = 0;

                if (!string.IsNullOrWhiteSpace(text))
                {
                    TextPaint textPaint = Control.Paint;
                    textPaint.GetTextBounds(text, 0, text.Length, textBounds);
                    iconTextSpacing = 20;
                }
                else
                {
                    textBounds.SetEmpty();
                }

                int width = Control.Width - (Control.PaddingLeft + Control.PaddingRight);

                Drawable[] drawables = Control.GetCompoundDrawables();

                if (drawables[0] != null)
                {
                    drawables[0].CopyBounds(drawableBounds);

                    int leftOffset =
                        (width - (textBounds.Width() + drawableBounds.Width())) / 2 - Control.CompoundDrawablePadding - iconTextSpacing;

                    if (drawableBounds.Left == 0 && drawableBounds.Left != leftOffset)
                    {
                        drawableBounds.Offset(leftOffset, 0);
                        drawables[0].SetBounds(drawableBounds.Left, drawableBounds.Top, drawableBounds.Right, drawableBounds.Bottom);
                    }
                }

                if (drawables[2] != null)
                {
                    drawables[2].CopyBounds(drawableBounds);

                    int rightOffset =
                        ((textBounds.Width() + drawableBounds.Width()) - width) / 2 + Control.CompoundDrawablePadding + iconTextSpacing;

                    if (drawableBounds.Left == 0 && drawableBounds.Right != rightOffset)
                    {
                        drawableBounds.Offset(rightOffset, 0);
                        drawables[2].SetBounds(drawableBounds.Left, drawableBounds.Top, drawableBounds.Right, drawableBounds.Bottom);
                    }
                }
            }


            //if (Control.GetCompoundDrawables() != null)
            //{
            //    if (BaseElement.CenterImage)
            //    {
            //        var imageRight = Control.GetCompoundDrawables()[2];
            //        if (imageRight != null)
            //        {
            //            var drawableBounds = new Android.Graphics.Rect();
            //            imageRight.CopyBounds(drawableBounds);
            //            SetImagePadding(drawableBounds.Width());
            //        }

            //        var imageLeft = Control.GetCompoundDrawables()[0];
            //        if (imageLeft != null)
            //        {
            //            var drawableBounds = new Android.Graphics.Rect();
            //            imageLeft.CopyBounds(drawableBounds);
            //            SetImagePadding(drawableBounds.Width());
            //        }
            //    }
            //}
        }