c# - WPF: Remove control's explicit foreground color -
two sample textboxes in standard color scheme , following constructor yield box1 gray foreground , box2 black foreground, since box2's foreground color has been explicitly set.
public partial class mainwindow : window { public mainwindow() { initializecomponent(); box2.foreground = brushes.black; box1.isenabled = false; box2.isenabled = false; } }
i "unset" foreground color box2 "falls back" default disabled color , has gray foreground when isenabled set false. possible? if so, how done?
setting foreground property null not have desired effect. want avoid explicitly setting foreground color gray if possible, since not compatible customized color schemes.
i not sure if that's mean, try following code:
public partial class mainwindow : window { public mainwindow() { initializecomponent(); box2.foreground = brushes.black; box1.isenabled = false; box2.isenabled = false; box2.clearvalue(textbox.foregroundproperty); } }
Comments
Post a Comment