locked
Adorner in WPF Textbox RRS feed

  • Question

  •  I have adorner on the text box. I want to draw a line under the particular text of the textbox. How to get the bounds of the particular text in the textbox. Please let me know if you have any idea.

    • Moved by CoolDadTx Wednesday, July 1, 2020 1:23 PM WPF related
    Wednesday, July 1, 2020 7:14 AM

All replies

  • Consider GetRectFromCharacterIndex for starting and ending positions of your range. Then combine the rectangles using Rect.Union.

    Wednesday, July 1, 2020 8:30 AM
  • MyTextBox.Text = "Adorn the text in the textbox";   --> this is my text

    MyTextBox.GetRectFromCharacterIndex(15);    --> while using this code i got the below mentioned values. Could you explain me how to use this.

    {Empty}
        Bottom: -Infinity
        BottomLeft: {∞,-∞}
        BottomRight: {-∞,-∞}
        Height: -Infinity
        IsEmpty: true
        Left: Infinity
        Location: {∞,∞}
        Right: -Infinity
        Size: {Empty}
        Top: Infinity
        TopLeft: {∞,∞}
        TopRight: {-∞,∞}
        Width: -Infinity
        X: Infinity
        Y: Infinity
        _height: -Infinity
        _width: -Infinity
        _x: Infinity
        _y: Infinity

    Wednesday, July 1, 2020 9:44 AM
  • This forum is for C#-specific questions only. Please post questions related to WPF in the Microsoft Q&A forums.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, July 1, 2020 1:23 PM
  • I know how to append text to a text file with the textbox and streamwriter.
    but how do i make the text box save the content after i press the next button or go back. Maybe hit should go to youtobe to learn more 


    Wednesday, July 1, 2020 1:51 PM