Skip to content

Commit

Permalink
chore: Remove legacy key handling on ComboBoxItems
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Oct 5, 2024
1 parent e078c35 commit 1d75aad
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBoxItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,6 @@ public ComboBoxItem()
DefaultStyleKey = typeof(ComboBoxItem);
}

protected override void OnKeyDown(KeyRoutedEventArgs args)
{
if (ItemsControl.ItemsControlFromItemContainer(this) is ComboBox comboBox)
{
if ((args.Key is VirtualKey.Enter or VirtualKey.Space) && comboBox.IsDropDownOpen)
{
var item = comboBox.ItemFromContainer(this);
if (item != null)
{
comboBox.SelectedItem = item;
comboBox.IsDropDownOpen = false;
args.Handled = true;
}
}

if (!args.Handled)
{
// Fallback to combobox keydown handling
args.Handled = comboBox.TryHandleKeyDown(args, this);
}
}

base.OnKeyDown(args);
}

internal void ChangeVisualStateInternal(bool useTransitions) => ChangeVisualState(useTransitions);

private protected override void ChangeVisualState(bool useTransitions)
Expand Down

0 comments on commit 1d75aad

Please sign in to comment.