joby james
joby james

Reputation: 71

Change Textbox to Label in WPF

How can I change all TextBoxes to Labels when a button is clicked?

Upvotes: 0

Views: 618

Answers (2)

Abbas
Abbas

Reputation: 14432

You could do as @devdigital said, which is a correct solution. What you also could do is set the IsReadOnly property to true. This way you achieve the same as when disabling the TextBox, but instead you don't get an ugly grayed-out one where you cannot select the Text/Content from the TextBox.

Upvotes: 1

devdigital
devdigital

Reputation: 34359

You would be better setting them all to disabled (IsEnabled = false) or read only (IsReadOnly = true), and changing the TextBox style to suit your needs.

There are some examples here for changing the style of a TextBox.

Upvotes: 1

Related Questions