简体   繁体   中英

LostFocus event problem and Button Command in wpf

I have a textbox and inside its lost focus event, I show a new window and give the user choices, I also have a button below the text box.

Now, when I change the value of the text box..and click the button (while the cursor is still inside the text box...) the lost focus event gets fired... but as I show a modal window dialog, the button's click event is not being fired....

Is there a way to get around it?

Don't affect significant ui via the lost focus event. You're popping up a new window in the wrong situation- if your user ever wants to do anything interesting after entering a value in that textbox, the modal dialog will pop up because the textbox will lose focus. Instead, consider making an editable combobox where the items in the drop down are your user choices.

If you want to hack, you may be able to get away with only popping up suggestions if the textbox has no text in it on a lost focus event. I think it's a lousy solution, but it might fit your constraints.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM