private void toggleIcon() { if (IsSelected.Value == false) { icon.Show(); IsSelected.Value = true; } else { icon.Hide(); IsSelected.Value = false; } }
private void load() { Height = 150; AutoSizeAxes = Axes.X; Action = () => toggleIcon(); Children = new Drawable[] { ColorBox = new Box { RelativeSizeAxes = Axes.Both, Colour = new Colour4(randomNumber(), randomNumber(), randomNumber(), 255) }, new FillFlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Child = new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = Text, Font = new FontUsage(size: 60) } }, new Container { RelativeSizeAxes = Axes.Y, Width = 150, Padding = new MarginPadding(30), Child = icon = new SpriteIcon { RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.CheckCircle } } } } }; icon.Hide(); byte randomNumber() { return((byte)(random.NextDouble() * 255)); } }