Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable all input controls in a WPF Window

Tags:

wpf

Is there a way to make an entire WPF Window inert after a button click?

The window is invoked via Window.ShowDialog() and after use, the window is no longer needed for interaction but I leave it open to remind the user of the inputs in TextBox's, ListBox's, and give visual feedback via OxyPlot and so on. I leave it to the user to close the window manually.

One solution is to disable all buttons but that's tedious and it still leaves TextBox's functioning. That's not optimal because for anything to be functioning creates the wrong impression that the Window remains for anything other than looking at. It would be better for every control to be non-functioning by a single setting.

like image 862
H2ONaCl Avatar asked Jan 28 '26 16:01

H2ONaCl


1 Answers

I did it by putting a name on the WPF window code behind and then setting .IsEnabled false upon the appropriate button click. All buttons, combo boxes, text boxes, and even OxyPlot became inert at that point and most parts were greyed out.

like image 178
H2ONaCl Avatar answered Jan 31 '26 09:01

H2ONaCl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!