当我禁用一个控制(按钮),它是如此黑暗,它是非常难以阅读的文本。
因此,我使用扩展方法将不透明度设置为1.0 (100%),这样即使禁用时也可以轻松读取:
public static void IsEnabledSpecial(this System.Windows.UIElement control, bool isEnabled) {
control.IsEnabled = isEnabled;
control.Opacity = 1.0; // This makes a disabled control more readable
}
通常,当未为WPF