public override void SetStyle(ButtonStyle style) { Insist.IsTrue(style is IconButtonStyle, "style must be a ImageButtonStyle"); base.SetStyle(style); this.style = (IconButtonStyle)style; if (image != null) { UpdateImage(); } }
public IconButton(IconButtonStyle style) : base(style) { image = new Image(); iconImage = new Image(); var stck = new Stack(); image.SetScaling(Scaling.Fit); stck.Add(image); stck.Add(iconImage); Add(stck); SetStyle(style); PadLeft(style.PadLeft).PadRight(style.PadRight).PadTop(style.PadTop).PadBottom(style.PadBottom); SetSize(PreferredWidth, PreferredHeight); }