public IControl WithIcon(Text tooltip, IControl icon) { return(Layout.Dock() .Left(tooltip.IsDefault ? icon : icon.MakeHittable().Control) // The icon has to be hittable for tooltips to work .Left(Spacer.Small) .Fill(_control.CenterVertically()) .WithHeight(_control.DesiredSize.Height) .WithWidth(_control.DesiredSize.Width) .WithBackground(Color.AlmostTransparent) .SetToolTip(tooltip)); }
static IControl CreateButton(IControl icon, string text, Command clicked) { return(Button.Create( clicked: clicked, content: bs => Layout.Dock() .Left(icon.CenterVertically()) .Left(Spacer.Small) .Fill(Label.Create( text: text, color: Theme.DefaultText)) .Center())); }