From e078c35afaf4673d0a7d7ce67ff57b000fb6559d Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Wed, 25 Sep 2024 12:26:26 +0200 Subject: [PATCH] chore: Tunneling events, fixes --- .../combobox/ComboBoxIntegrationTests.cs | 2 +- .../Primitives/Selector.partial.h.mux.cs | 2 +- src/Uno.UI/UI/Xaml/UIElement.RoutedEvents.cs | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Uno.UI.RuntimeTests/IntegrationTests/dxaml/controls/combobox/ComboBoxIntegrationTests.cs b/src/Uno.UI.RuntimeTests/IntegrationTests/dxaml/controls/combobox/ComboBoxIntegrationTests.cs index 0c66e8db389e..45b82451741d 100644 --- a/src/Uno.UI.RuntimeTests/IntegrationTests/dxaml/controls/combobox/ComboBoxIntegrationTests.cs +++ b/src/Uno.UI.RuntimeTests/IntegrationTests/dxaml/controls/combobox/ComboBoxIntegrationTests.cs @@ -1086,7 +1086,7 @@ await RunOnUIThread(() => } [TestMethod] - [Ignore("The first verify fails as ComboBox pre-selects index 0 due to SelectionChangedTrigger.Always #17988")] + [Ignore("The first verify fails as ComboBox pre-selects index 0 due to SelectionChangedTrigger.Always. This is likely a new behavior! #17988")] public async Task ValidateKeyboardInteraction() { var comboBox = await SetupBasicComboBoxTest(); diff --git a/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.partial.h.mux.cs b/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.partial.h.mux.cs index d9c5d4832820..98080d09dbf9 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.partial.h.mux.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Primitives/Selector.partial.h.mux.cs @@ -19,7 +19,7 @@ partial class Selector // m_focusedIndex to make it easier to track when this field is read & written. private protected int GetFocusedIndex() => m_focusedIndex; - void SetFocusedIndex(int focusedIndex) + internal void SetFocusedIndex(int focusedIndex) { if (m_focusedIndex != focusedIndex) { diff --git a/src/Uno.UI/UI/Xaml/UIElement.RoutedEvents.cs b/src/Uno.UI/UI/Xaml/UIElement.RoutedEvents.cs index 89802c017859..294cd5cd57f4 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.RoutedEvents.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.RoutedEvents.cs @@ -590,6 +590,22 @@ internal bool SafeRaiseEvent(RoutedEvent routedEvent, RoutedEventArgs args, Bubb } } + internal bool SafeRaiseTunnelingEvent(RoutedEvent routedEvent, RoutedEventArgs args) + { + try + { + RaiseTunnelingEvent(routedEvent, args); + return true; + } + catch (Exception e) + { + if (this.Log().IsEnabled(LogLevel.Error)) + { + this.Log().Error($"Failed to raise '{routedEvent.Name}': {e}"); + } + return false; + } + } /// /// Raise a routed event