locked
How to check if text in an EditBox is too long to show all? (clipping check?) RRS feed

  • Question

  • I have an EditBox and want to show text color to red if some characters in the text are clipped.

     

    What's the best way to check clipping?

    Tuesday, May 1, 2007 2:14 PM

Answers

  • I assume you mean TextBox, not EditBox (which doesn't exist in WPF).

     

    TextBox.ExtentWidth returns the horizontal size of scrollable content, which you can compare against the size of the viewport (TextBox.ViewportWidth).  If you've restyled your TextBox so that it doesn't contain a ScrollViewer, however, these will always return 0.

     

      - Peter

    Tuesday, May 1, 2007 7:41 PM