From 34558f25e0489e4c231c6217dfcf0c949b9ac5c6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 19 Jul 2024 03:02:34 +0200 Subject: [PATCH] Only update selection if focus comes from TabItem. (#16338) This is a temporary workaround to help Actipro's issues #15433: they're embedding other controls in a `TabControl`-derived control and they don't want these other controls to change the selection when they're focused. --- src/Avalonia.Controls/TabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/TabControl.cs b/src/Avalonia.Controls/TabControl.cs index 40c10fe29f..cb517b293d 100644 --- a/src/Avalonia.Controls/TabControl.cs +++ b/src/Avalonia.Controls/TabControl.cs @@ -256,7 +256,7 @@ namespace Avalonia.Controls { base.OnGotFocus(e); - if (e.NavigationMethod == NavigationMethod.Directional) + if (e.NavigationMethod == NavigationMethod.Directional && e.Source is TabItem) { e.Handled = UpdateSelectionFromEventSource(e.Source); }