0

The default TextBox in WPF, once set isEnabled to False, the whole TextBox is grayed out. I want to protect the TextBox.Text from being modified and want the TextBox to remain its style (ForeGround and Background color). Is there an easy work around to achieve this, other than to write the template to override the TextBox?

H.B.
  • 166,899
  • 29
  • 327
  • 400
KMC
  • 19,548
  • 58
  • 164
  • 253

2 Answers2

4

Check or set the property IsReadOnly of the TextBox to true.

kazinix
  • 28,987
  • 33
  • 107
  • 157
1

Set IsReadOnly to true.

See: http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.textboxbase.isreadonly.aspx

ColinE
  • 68,894
  • 15
  • 164
  • 232