Example #1
0
        public void SetStyle(ImageTextButtonStyle style)
        {
            Insist.IsTrue(style is ImageTextButtonStyle, "style must be a ImageTextButtonStyle");

            base.SetStyle(style);

            if (image != null)
            {
                UpdateImage();
            }

            if (label != null)
            {
                var labelStyle = label.GetStyle();
                labelStyle.Font      = style.Font;
                labelStyle.FontColor = style.FontColor;
                label.SetStyle(labelStyle);
            }
        }
Example #2
0
        public ImageTextButton(string text, ImageTextButtonStyle style) : base(style)
        {
            this.style = style;

            Defaults().Space(3);

            image = new Image();
            image.SetScaling(Scaling.Fit);

            label = new Label(text, style.Font, style.FontColor);
            label.SetAlignment(UI.Align.Center);

            Add(image);
            Add(label);

            SetStyle(style);

            SetSize(PreferredWidth, PreferredHeight);
        }