21

currently i have a textblock placed in a scroll viewer control. How do i make the textblock read only?

jeremychan
  • 4,309
  • 10
  • 42
  • 56

3 Answers3

30

Textblocks are already readonly. They are intended to display a small amount of flow text. Perhaps you thought you were dealing with a TextBox instead?

BinaryTox1n
  • 3,486
  • 1
  • 36
  • 44
  • oh ok thanks for your info. because i read from somewhere in order to make textblock text selectable i have to make the textblock read only – jeremychan Feb 22 '11 at 01:55
  • If that is what you want, you should use the TextBOX control (I provided a link in my answer) and set IsReadOnly="true" on that new TextBox control. That will do what you want. – BinaryTox1n Feb 22 '11 at 01:59
2

BinaryTox1n answered your question, but if you need the text to be selectable see the previous StackOverflow question.

Community
  • 1
  • 1
kevindaub
  • 3,293
  • 6
  • 35
  • 46
0

Bind the Textblock to a property with only a getter and it will be a readonly textblock.

Jaswir
  • 172
  • 11