I am having focus issues with combo boxes that have their IsEditable property set to true. The issues go away as soon as I set the property to false.
First, with IsEditable set to true the IsFocused property is never ever true.
Second, with the IsEditable property set to true, whenever I put the focus on the combo box, either manually through the UI or through code the combo box first fires the LostFocus event and then the GotFocus event. Even in the GotFocus event the IsFocused property if false! Again, set IsEditable property to false and focus works as expected. Only GotFocus is called and the IsFocused property is correctly set to true.
When IsEditable is set to true I am able to enter characters into the text box portion of the combo box. The combo box will initially have no items, its going to be used to maintain a history of entered items, however I have tested with a pre-populated combo box and get the same behavior.
I have reproduced this behavior in a simple one window one control wpf app.
Additionally, I noticed that when I had IsEditable set to false and would mouse over the drop down list to select an item, the combo box was losing and geting focus. What the heck?
Any suggestions would be greatly appreciated. At the moment it looks like I have to create my own combo box.
We are not using focus groups.
Here is the XAML for my combo box.
<ComboBox HorizontalAlignment="Stretch" Margin="10,3,3,3" VerticalAlignment="Center" IsSynchronizedWithCurrentItem="True" Grid.Column="1" MinWidth="100" IsEditable="True" TabIndex="0" IsTabStop="True" Name="ApplicationServerComboBox" SelectionChanged="ApplicationServerComboBox_SelectionChanged" IsTextSearchEnabled="True" LostFocus="ApplicationServerComboBox_LostFocus" GotFocus="ApplicationServerComboBox_GotFocus" />
Edit: I just did another test with IsEditable set to true: Keyboard.FocusedElement tells me TextBox has the keyboard focus.
Isn't this supposed to get routed to the parent? The name of the TextBox is PART_EditableTextBox.
First, with IsEditable set to true the IsFocused property is never ever true.
Second, with the IsEditable property set to true, whenever I put the focus on the combo box, either manually through the UI or through code the combo box first fires the LostFocus event and then the GotFocus event. Even in the GotFocus event the IsFocused property if false! Again, set IsEditable property to false and focus works as expected. Only GotFocus is called and the IsFocused property is correctly set to true.
When IsEditable is set to true I am able to enter characters into the text box portion of the combo box. The combo box will initially have no items, its going to be used to maintain a history of entered items, however I have tested with a pre-populated combo box and get the same behavior.
I have reproduced this behavior in a simple one window one control wpf app.
Additionally, I noticed that when I had IsEditable set to false and would mouse over the drop down list to select an item, the combo box was losing and geting focus. What the heck?
Any suggestions would be greatly appreciated. At the moment it looks like I have to create my own combo box.
We are not using focus groups.
Here is the XAML for my combo box.
<ComboBox HorizontalAlignment="Stretch" Margin="10,3,3,3" VerticalAlignment="Center" IsSynchronizedWithCurrentItem="True" Grid.Column="1" MinWidth="100" IsEditable="True" TabIndex="0" IsTabStop="True" Name="ApplicationServerComboBox" SelectionChanged="ApplicationServerComboBox_SelectionChanged" IsTextSearchEnabled="True" LostFocus="ApplicationServerComboBox_LostFocus" GotFocus="ApplicationServerComboBox_GotFocus" />
Edit: I just did another test with IsEditable set to true: Keyboard.FocusedElement tells me TextBox has the keyboard focus.
Isn't this supposed to get routed to the parent? The name of the TextBox is PART_EditableTextBox.