开发者

Reset TextBox.Background to default in WPF so it still gets updated when system settings change

I have 开发者_如何转开发a TextBox that I wish to reset its Background property to its default value after changing it to a different colour.

I have tried setting it to SystemColors.WindowBrush, but then, if the Display Settings are updated to change this value, it doesn't get dynamically reflected in the TextBox (it does normally if TextBox.Background hasn't been touched).

Any idea how to do this?


From what I understand of WPF's binding system, setting it to DependencyProperty.UnsetValue should revert it to WPF figuring out what to do with it.


for Wpf this line work for me:

TextBox1.ClearValue(TextBox.BackgroundProperty);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜