Thread: how to highlight/select text in a wpf textbox without focus?

  1. #1
    Registered User
    Join Date
    Aug 2012
    Location
    Dubai, United Arab Emirates, United Arab Emirates
    Posts
    1

    how to highlight/select text in a wpf textbox without focus?

    I want to highlight selected text in a wpf textbox while the textbox is not focused. In my application, my textbox never gets focus, and every key input is done manually.
    I was wondering if there is a way to highlight the selected text when the textbox is not focused?
    Any help would be appreciated!

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Are you using MVVM? If so you can use the attached property pattern to accomplish this. If not you can use code behind. Both methods will use INotifyPropertyChanged implementations and should bind to the property on the control that controls the highlighted text.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Insert text to browser's textbox
    By Ducky in forum Windows Programming
    Replies: 4
    Last Post: 05-01-2009, 11:56 PM
  2. c# Changing Textbox.Text from different class
    By Mastermosley in forum C# Programming
    Replies: 10
    Last Post: 03-10-2009, 12:10 AM
  3. Text->Contains and Select
    By Coding in forum C# Programming
    Replies: 0
    Last Post: 03-21-2008, 04:49 PM
  4. inserting text in a textbox
    By Rune Hunter in forum C# Programming
    Replies: 1
    Last Post: 01-07-2006, 05:32 PM

Tags for this Thread