lostfocus

How do you solve this LostFocus/LostKeyboardFocus issue?

喜欢而已 提交于 2019-11-30 09:00:51
Ok, I have a control that has an IsEditing property which for argument's sake has a default template that is normally a text block, but when IsEditing is true, it swaps in a textbox for in-place editing. Now when the control loses focus, if it's still editing, it's supposed to drop out of editing mode and swap back in the TextBlock template. Pretty straight forward, right? Think of the behavior of renaming a file in Windows Explorer or on your desktop (which is the same thing I know...) That's the behavior we want. The issue is you can't use the LostFocus event because when you switch to

How do you solve this LostFocus/LostKeyboardFocus issue?

a 夏天 提交于 2019-11-29 12:47:46
问题 Ok, I have a control that has an IsEditing property which for argument's sake has a default template that is normally a text block, but when IsEditing is true, it swaps in a textbox for in-place editing. Now when the control loses focus, if it's still editing, it's supposed to drop out of editing mode and swap back in the TextBlock template. Pretty straight forward, right? Think of the behavior of renaming a file in Windows Explorer or on your desktop (which is the same thing I know...) That

How can I know when an EditText loses focus?

走远了吗. 提交于 2019-11-26 16:06:31
I need to catch when an EditText loses focus, I've searched other questions but I didn't find an answer. I used OnFocusChangeListener like this OnFocusChangeListener foco = new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub } }; But, it doesn't work for me. ρяσѕρєя K Implement onFocusChange of setOnFocusChangeListener and there's a boolean parameter for hasFocus. When this is false, you've lost focus to another control. EditText txtEdit = (EditText) findViewById(R.id.edittxt); txtEdit.setOnFocusChangeListener(new