When I disable a control (button), it is so dark that it is very hard to read the text.
So I am using an extension method to set the opacity to 1.0 (100%) so it can be read easily, even when disabled:
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
}
Normally, when opacity is not explicitly set for a WPF control, it appears to toggle between 1.0 (100%) when the control is enabled and 0.35 (35%) when the control is disabled.
Once I explicitly set the opacity using the extension method, the control thereafter ceases to toggle between 1.0 and 0.35 when I set IsEnabled without the extension method. It gets "stuck" at 1.0 (100%), even when IsEnabled is set to false;
After I set the opacity, how can I later reset the control to do its normal opacity toggling between 1.0 and 0.35?