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

This is a discussion on how to highlight/select text in a wpf textbox without focus? within the C# Programming forums, part of the General Programming Boards category; I want to highlight selected text in a wpf textbox while the textbox is not focused. In my application, my ...

  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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    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-02-2009, 12:56 AM
  2. c# Changing Textbox.Text from different class
    By Mastermosley in forum C# Programming
    Replies: 10
    Last Post: 03-10-2009, 01:10 AM
  3. Text->Contains and Select
    By Coding in forum C# Programming
    Replies: 0
    Last Post: 03-21-2008, 05: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


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21