WPF How To Tell If A Control Was Tabbed Into Focus? - c#

I've got a ComboBox where I need to determine if it was tabbed into focus vs. clicked/touched into focus.
The ComboBox default behavior for being tabbed into focus does not open the drop-down part, which is different than if it is clicked/touched into focus...yet all three bring it into focus.

Related

WPF Keep textbox focussed while pressing tab key

I am writing a WPF application where we are supposed to shift focus from one button to another by pressing the TAB key.
All is fine, but for a specific page, there is a textbox which is always focused so that the user can type in it immediately. But now, when I press TAB, the focus is shifted to the button (which is as per requirement) but as the focus is lost from the textbox, I cannot type anymore.
I want to have a behavior where I can keep the Keyboard focus on textbox but should be able to control the buttons using TAB key as well. In a way, I need to have focus on textbox and the buttons at the same time. Is this possible?
Tried the FocusManager.IsFocusScope = "true", but this did not help.

On Wpf container tabbing is not loosing focus on button

A button on wpf container is not loosing focus style while tabbing across the windows.The control does go to the other elements but the button will still have the focus style on it.
Does the button have IsDefault=True? This will cause the button to always have keyboard focus for the Enter key as long as another control is not capturing the keyboard input.

manually exit from typing mode of textbox in WP7

I have a scenario in my windows phone 7 app. I have panarama control and it has 4 items in it. Let say in first Item I have textbox and my focus on it Mean My cursor in it and I was typing on this textbox. But when typing mean when my focus is still in textbox and I changes the panorama item. My textbox focus is still there and still its in typing mode. How I can exit my textbox from typing mode on panaroma selection change.
Windows Phone has no way to hide the keyboard other than to focus on a different element.
For example, if you have a hidden button, call button.focus(); to hide the soft-keyboard.

User control doesn't react when I pressed a tab button

I have a windows application: a main form and several user controls on it.
Tab button doesn't work as I expected. I thought it goes through all user controls on form. But I was wrong. When user control received focus (using mouse click) it didn't want to go anyway using tab button. What thing can be wrong ? Did I miss something ?
I didn't override ProcessCmdKey and other key_down events. All user controls have TabStop property = true.
C#, .net 2.0, WinForms
you can use "Tab Order" tool in "Layout" toolbar to see the current TabIndex values. make sure TabIndex is correct (starts from 0) including tabIndex in the actual UserControl as well. quickly tried on mine and seems to work. Do u have any binding setup to these controls

wpf textbox focus issue

I have a control with several textbox controls on it.
Now, when I press tab after I edit one of the textboxes, the focus is switched to the next textbox BUT I need to press an additional tab in order for it to enter the "editing" stage.
The first tab simply draws a dotted background on the textbox ... and the second one actually puts the cursor position inside the textbox. Is there a way when I press tab, to automatically set the cursor inside the textbox?
Thanks./
Are you sure you don't have any hidden controls or other controls that might be accepting focus before your textbox? Either way, you should be able to update the tabindex value of your controls so they follow a logical sequence when tab is pressed.

Categories