/// <summary> /// Set button design Enable like / Disable like /// </summary> /// <param name="button"></param> /// <param name="sw"></param> private void ButtonEnable(TButton button, bool sw = true) { if (sw) { button.Foreground = new SolidColorBrush(ButtonForegroundColor); } else { button.Foreground = new SolidColorBrush(ColorUtil.ChangeAlpha(ButtonForegroundColor, 0.25f)); } }
public void Test001() { var c = ColorUtil.From("Red"); Assert.AreEqual(c, Colors.Red); c = ColorUtil.From("0xffff0000"); Assert.AreEqual(c, Colors.Red); c = ColorUtil.From("#ffff0000"); Assert.AreEqual(c, Colors.Red); c = ColorUtil.From("#FFFF0000"); Assert.AreEqual(c, Colors.Red); c = ColorUtil.ChangeAlpha(c, 0.5f); Assert.AreEqual(c.A, 127); }