Editable ComboBox Keyboard Navigation Issues
- It appears as if there is a defect in the WPF ComboBox control pertaining to keyboard navigation (tab) behavior when the ComboBox.IsEditable property is set to true. Consider the following simple example:
<Window x:Class="KeyboardNavProto.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Keyboard Navigation Prototype" Height="156" Width="378"> <WrapPanel> <ComboBox SelectedIndex="0" IsEditable="True"> <ComboBoxItem Content="A" /> <ComboBoxItem Content="B" /> <ComboBoxItem Content="C" /> </ComboBox> <ComboBox SelectedIndex="0" IsEditable="True" IsTabStop="False"> <ComboBoxItem Content="A" /> <ComboBoxItem Content="B" /> <ComboBoxItem Content="C" /> </ComboBox> <ComboBox SelectedIndex="0" IsEditable="True"> <ComboBoxItem Content="A" /> <ComboBoxItem Content="B" /> <ComboBoxItem Content="C" /> </ComboBox> </WrapPanel> </Window>
You would expect for the second ComboBox (whose IsTabStop=false) to be skipped, but it is not. You can tab forward and backwards (shift+tab) to it, even though it should no longer be participating in the tab order. An addtional quirk is if an editable ComboBox's IsTabStop is explicitly set to true as show below:
<ComboBox SelectedIndex="0" IsEditable="True" IsTabStop="True"> <ComboBoxItem Content="A" /> <ComboBoxItem Content="B" /> <ComboBoxItem Content="C" /> </ComboBox>
You can tab forward to the ComboBox, forward tab out of it to the next control, but you can't backward tab (shift+tab) out of it to the previous control.
I've gone as far as replacing the ComboBox's control template, but even this doesn't seem to solve the issues, which seem to be intrinsic to the ComboBox control implementation.
I verified this problem in .NET 3.5 SP1, and .NET 4.0 Beta 2.
None of these issues seem to apply to a non-editable ComboBox, which behaves as expected in regards to the setting of the IsTabStop property.
We have a need to have our ComboBoxes editable, but would like to remove some of those editable ComboBoxes from the tab order. We have found other workarounds (like responding to when they've been entered and forcing the keyboard focus to the next control in an event handler), but would like to know if this is a recoginzed issue and when/if it will be fixed.
Thanks,
Brandon
All Replies
Hi Brandon,
MSDN Subscriber Support in Forum
I performed a test based on your description and did reproduce the problem on my side. Besides your solution, another workaround is to define a custom ControlTemplate for the ComboBox. But it requires much effort.
I have searched in our database and Microsoft Connect web site, but didn't find a similar issue. I will submit a feedback on this issue for you to Microsoft Connect web site:
https://connect.microsoft.com/visualstudio
Thank you for reporting this issue to us!
Sincerely,
Linda Liu
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Hi Brandon,
I have reported a feedback through Visual Studio & .NET Connect site:(https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=508705)
This issue will be routed to the product unit who works on this specific feature area for triage and resolution. I’ll paste all responses from the product unit in this thread. And you also can click the link and add the feedback to your watchlist ( you need to log in using your account) so that you can get informed as soon as product units respond. It may be some time before we get response from product unit. Please be patient.
Sincerely,
Linda Liu
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.- Hi Linda,
Thanks for taking the time to look into this. I actually tried a couple custom control templates (including the one from the Simple Styles sample from MSDN) for the ComboBox, but they all suffered from the same issue as the base implementation. I'll be interested in the progress of this issue within Microsoft.
Thanks again,
Brandon - You can set IsTabStop property on TextBox within comboBox explicitly
XAML:
<ComboBox Name="Combo1" SelectedIndex="0" IsEditable="True" IsTabStop="True">
<ComboBoxItem Content="A" />
<ComboBoxItem Content="B" />
<ComboBoxItem Content="C" />
</ComboBox>
XAML.cs :
OWindow_Loaded -
TextBox textBox = (TextBox)Combo1.Template.FindName("PART_EditableTextBox", Combo1);
textBox.IsTabStop = false;- Proposed As Answer byHimanshu Rakibe Friday, November 20, 2009 9:46 AM
- Unproposed As Answer bybmeardon Sunday, November 22, 2009 12:40 AM

