How to keep WPF TextBox selection when not focused?

后端 未结 5 854
清酒与你
清酒与你 2020-12-03 07:23

I want to show a selection in a WPF TextBox even when it\'s not in focus. How can I do this?

5条回答
  •  囚心锁ツ
    2020-12-03 07:56

    I found that the suggestions listed (add a LostFocus handler, defining a FocusScope) to not work, but I did come across the code listed here: http://naracea.com/2011/06/26/selection-highlight-and-focus-on-wpf-textbox/, which creates a custom Adorner that highlights the text when not focused.

提交回复
热议问题