How to remove focus from text box on wpf? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to remove focus from text box on wpf?

19th Feb 2021, 8:59 AM
Ванты Артём Дмитриевич
Ванты Артём Дмитриевич - avatar
3 Answers
+ 2
var textbox = document.querySelector('input'); textbox.blur(); // you should adapt the query string to target the right element ^^
19th Feb 2021, 12:20 PM
visph
visph - avatar
+ 1
Thanks!
19th Feb 2021, 6:29 PM
Ванты Артём Дмитриевич
Ванты Артём Дмитриевич - avatar
+ 1
I am not sure why you want to do this. Remove focus is not about getting the focus off the textbox, it it about defining where the focus should go. Do you want another textbox or control get the focus ? Also have a look at this link https://stackoverflow.com/questions/2914495/wpf-how-to-programmatically-remove-focus-from-a-textbox
19th Feb 2021, 6:55 PM
sneeze
sneeze - avatar