Here, we will test for the property values IsKeyboardFocused and IsKeyboardFocusWithin and if either of them is true then will open the DropDown.
void c1ComboBox_IsKeyboardFocusedChanged(object sender, DependencyPropertyChangedEventArgs e)
{
UpdateFocus();
}
void c1ComboBox_IsKeyboardFocusWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
{
UpdateFocus();
}
private void UpdateFocus()
{
this.Dispatcher.BeginInvoke(new Action(delegate
{
// handle both properties, as ComboBox is complicated control, can have different combination of this properties
if (c1ComboBox.IsKeyboardFocused || c1ComboBox.IsKeyboardFocusWithin)
{
c1ComboBox.IsDropDownOpen = true;
}
else
{
c1ComboBox.IsDropDownOpen = false;
}
}));
}