Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wpf - how should I auto-grey-out a textbox when it's associated radiobutton is not selected?

Tags:

c#

.net

wpf

What's the best approach to auto-grey-out a textbox if it's associated radiobutton is not selected?

I've got an open question out re using a dependency property (which I haven't got working) for this, however I'm not sure this is the appropriate approach. So basically when RadioButton 1 is selected the text field is enabled, however when RadioButton 2 is selected then the textfield should got NOT enabled.

like image 956
Greg Avatar asked Nov 14 '25 10:11

Greg


1 Answers

<RadioButton x:Name="RadioButton2" />
<TextBox IsEnabled="{Binding IsChecked, ElementName=RadioButton2}" />
like image 138
Jay Avatar answered Nov 17 '25 09:11

Jay



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!