From 3e3e76d564c2977c52598becb60a841259b812d0 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 18 Nov 2025 14:20:48 +0800 Subject: [PATCH 01/12] refactor: (core/TabControl) tab closing event interface --- samples/WpfApp1/MainWindow.xaml | 37 +++++----- samples/WpfApp1/WpfApp1.csproj | 2 +- .../Pages/Controls/Windows/TabViewPage.xaml | 2 +- .../Controls/Windows/TabViewPage.xaml.cs | 47 ++++++------- .../Controls/Helpers/TabControlHelper.cs | 69 +++++++++++-------- .../Controls/Helpers/TabItemHelper.cs | 37 ++-------- .../Controls/TabItemExtension.cs | 28 -------- 7 files changed, 85 insertions(+), 137 deletions(-) delete mode 100644 source/iNKORE.UI.WPF.Modern/Controls/TabItemExtension.cs diff --git a/samples/WpfApp1/MainWindow.xaml b/samples/WpfApp1/MainWindow.xaml index 9270aed3..cb6621f0 100644 --- a/samples/WpfApp1/MainWindow.xaml +++ b/samples/WpfApp1/MainWindow.xaml @@ -11,26 +11,21 @@ ui:WindowHelper.UseModernWindowStyle="True" Loaded="Window_Loaded" Background="{DynamicResource {x:Static ui:ThemeKeys.AcrylicBackgroundFillColorDefaultBrushKey}}"> - - - - - - - - - - - - - + + + + + Test + + + + + + + Test + + + + diff --git a/samples/WpfApp1/WpfApp1.csproj b/samples/WpfApp1/WpfApp1.csproj index 21cd1caa..6a4b2aac 100644 --- a/samples/WpfApp1/WpfApp1.csproj +++ b/samples/WpfApp1/WpfApp1.csproj @@ -13,7 +13,7 @@ - + diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml index 16b8f0e6..89d08673 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml @@ -167,7 +167,7 @@ Simply handle the event and set e.Cancel = true to keep the tab open. - + This tab demonstrates the default close behavior. When the close button is clicked, the tab closes immediately diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs index 082626c5..6bc298b6 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs @@ -87,29 +87,6 @@ private void RadioButtons_SelectionChanged(object sender, SelectionChangedEventA private void InitializeExample6() { ResetExample6Tabs(); - - tabControl.RegisterTabClosingEvent((menuControl, e) => - { - if (e.Tab.Tag is "ConfirmClose") - { - var msgResult = MessageBox.Show("Do you want to close this tab?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (msgResult != MessageBoxResult.OK) - { - e.Cancel = true; - return; - } - } - else if (e.Tab.Tag is "NiceTry") - { - e.Cancel = true; - - if ((e.Tab.Header as string) != NiceTry) - e.Tab.Header = NiceTry; - else e.Tab.Header = "You can't close me!"; - - return; - } - }); } private void ResetExample6Tabs() @@ -283,5 +260,29 @@ private void InitializeExample6() #endregion + + private void tabControl6_TabItemClosing(object sender, TabViewTabCloseRequestedEventArgs e) + { + if (e.Tab.Tag is "ConfirmClose") + { + var msgResult = MessageBox.Show("Do you want to close this tab?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question); + if (msgResult != MessageBoxResult.OK) + { + e.Cancel = true; + return; + } + } + else if (e.Tab.Tag is "NiceTry") + { + e.Cancel = true; + + if ((e.Tab.Header as string) != NiceTry) + e.Tab.Header = NiceTry; + else e.Tab.Header = "You can't close me!"; + + return; + } + + } } } diff --git a/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabControlHelper.cs b/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabControlHelper.cs index 490f3c44..82851a77 100644 --- a/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabControlHelper.cs +++ b/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabControlHelper.cs @@ -302,24 +302,47 @@ public static void SetIsAddTabButtonVisible(TabControl element, bool value) #endregion - #region TabControlHelperEvents - /// - /// Identifies the TabControlHelperEvents dependency property. - /// - public static readonly DependencyProperty TabControlHelperEventsProperty = DependencyProperty.RegisterAttached( - "TabControlHelperEvents", - typeof(TabControlHelperEvents), - typeof(TabControlHelper), - new PropertyMetadata(new TabControlHelperEvents())); + #region TabItemClosingEvent + + public static readonly RoutedEvent TabItemClosingEvent = EventManager.RegisterRoutedEvent( + "TabItemClosing", + RoutingStrategy.Direct, + typeof(EventHandler), + typeof(TabControlHelper)); - public static TabControlHelperEvents GetTabControlHelperEvents(TabControl element) + public static void AddTabItemClosingHandler(TabControl tabControl, EventHandler handler) + { + tabControl.AddHandler(TabItemClosingEvent, handler); + } + public static void RemoveTabItemClosingHandler(TabControl tabControl, EventHandler handler) { - return (TabControlHelperEvents)element.GetValue(TabControlHelperEventsProperty); + tabControl.RemoveHandler(TabItemClosingEvent, handler); } #endregion + #region AddTabButtonClickEvent + + public static readonly RoutedEvent AddTabButtonClickEvent = EventManager.RegisterRoutedEvent( + "AddTabButtonClick", + RoutingStrategy.Direct, + typeof(RoutedEventHandler), + typeof(TabControlHelper)); + + public static void AddAddTabButtonClickHandler(TabControl tabControl, RoutedEventHandler handler) + { + tabControl.AddHandler(AddTabButtonClickEvent, handler); + } + + public static void RemoveAddTabButtonClickHandler(TabControl tabControl, RoutedEventHandler handler) + { + tabControl.RemoveHandler(AddTabButtonClickEvent, handler); + } + + #endregion + + #region AddTabButtonCommand /// @@ -393,7 +416,8 @@ private static void OnLoaded(object sender, RoutedEventArgs e) { void OnAddButtonClick(object sender, RoutedEventArgs e) { - GetTabControlHelperEvents(TabControl).AddTabButtonClick?.Invoke(TabControl, e); + RoutedEventArgs args = new RoutedEventArgs(AddTabButtonClickEvent, TabControl); + TabControl.RaiseEvent(args); } AddButton.Click += OnAddButtonClick; } @@ -442,7 +466,7 @@ public enum TabViewCloseButtonOverlayMode /// /// Provides data for a tab close event. /// - public sealed class TabViewTabCloseRequestedEventArgs + public class TabViewTabCloseRequestedEventArgs : RoutedEventArgs { /// /// Gets a value that represents the data context for the tab in which a close is being requested. @@ -459,26 +483,11 @@ public sealed class TabViewTabCloseRequestedEventArgs /// public bool Cancel { get; set; } - internal TabViewTabCloseRequestedEventArgs(object item, TabItem tab) + internal TabViewTabCloseRequestedEventArgs(RoutedEvent routedEvent, object item, TabItem tab) + : base(routedEvent) { Item = item; Tab = tab; } } - - /// - /// Events for TabControlHelper. - /// - public class TabControlHelperEvents - { - /// - /// Occurs when the add (+) tab button has been clicked. - /// - public TypedEventHandler AddTabButtonClick; - - /// - /// Raised when the user attempts to close a Tab via clicking the x-to-close button, CTRL+F4, or mousewheel. - /// - public TypedEventHandler TabCloseRequested; - } } diff --git a/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabItemHelper.cs b/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabItemHelper.cs index e2c3c358..02c6f661 100644 --- a/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabItemHelper.cs +++ b/source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabItemHelper.cs @@ -177,24 +177,6 @@ private static void SetCloseTabButtonCommand(TabItem tabItem, ICommand value) #endregion - #region TabItemHelperEvents - - /// - /// Identifies the TabItemHelperEvents dependency property. - /// - public static readonly DependencyProperty TabItemHelperEventsProperty = DependencyProperty.RegisterAttached( - "TabItemHelperEvents", - typeof(TabItemHelperEvents), - typeof(TabItemHelper), - new PropertyMetadata(new TabItemHelperEvents())); - - public static TabItemHelperEvents GetTabItemHelperEvents(TabItem element) - { - return (TabItemHelperEvents)element.GetValue(TabItemHelperEventsProperty); - } - - #endregion - private static void OnLoaded(object sender, RoutedEventArgs e) { TabItem TabItem = sender as TabItem; @@ -226,14 +208,14 @@ private static void OnLoaded(object sender, RoutedEventArgs e) void ExecutedCustomCommand(object sender, ExecutedRoutedEventArgs e) { - var eventArgs = new TabViewTabCloseRequestedEventArgs(TabItem.Content, TabItem); - TabControlHelper.GetTabControlHelperEvents(TabControl).TabCloseRequested?.Invoke(TabControl, eventArgs); - if (eventArgs.Cancel) + var eargs = new TabViewTabCloseRequestedEventArgs(TabControlHelper.TabItemClosingEvent, TabItem.Content, TabItem); + TabControl.RaiseEvent(eargs); + + if (eargs.Cancel) { return; } - GetTabItemHelperEvents(TabItem).CloseRequested?.Invoke(TabItem, new TabViewTabCloseRequestedEventArgs(TabItem.Content, TabItem)); if (TabControl.SelectedItem == TabItem) { TabControl.SelectedIndex--; @@ -326,15 +308,4 @@ private static void UpdateTabGeometry(TabItem tabItem) catch { } } } - - /// - /// Events for TabItemHelper. - /// - public class TabItemHelperEvents - { - /// - /// Raised when the user attempts to close the TabViewItem via clicking the x-to-close button, CTRL+F4, or mousewheel. - /// - public TypedEventHandler CloseRequested; - } } diff --git a/source/iNKORE.UI.WPF.Modern/Controls/TabItemExtension.cs b/source/iNKORE.UI.WPF.Modern/Controls/TabItemExtension.cs deleted file mode 100644 index 10ecaf1a..00000000 --- a/source/iNKORE.UI.WPF.Modern/Controls/TabItemExtension.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Windows.Controls; -using iNKORE.UI.WPF.Modern.Common; -using iNKORE.UI.WPF.Modern.Controls.Helpers; - -namespace iNKORE.UI.WPF.Modern.Controls; - -public static class TabItemExtension -{ - public static void RegisterTabClosingEvent(this TabControl tabControl, TypedEventHandler handler) - { - if (tabControl.GetValue(TabControlHelper.TabControlHelperEventsProperty) is not TabControlHelperEvents eventHelper) - { - return; - } - - eventHelper.TabCloseRequested += handler; - } - - public static void UnregisterTabClosingEvent(this TabControl tabControl, TypedEventHandler handler) - { - if (tabControl.GetValue(TabControlHelper.TabControlHelperEventsProperty) is not TabControlHelperEvents eventHelper) - { - return; - } - - eventHelper.TabCloseRequested -= handler; - } -} From 25c06d2a003ee62bd7f1473d70c239127bdc56e6 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 18 Nov 2025 14:23:12 +0800 Subject: [PATCH 02/12] refactor: (gallery/TabViewPage) update sample code --- .../Controls/Windows/TabViewPage.xaml.cs | 39 ++++++++----------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs index 6bc298b6..ef62c375 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml.cs @@ -220,7 +220,7 @@ public void UpdateExampleCode() "; public string Example6Xaml => $@" - + @@ -228,33 +228,28 @@ public void UpdateExampleCode() "; public string Example6CS => $@" -// Invoked during the constructor after InitializeComponent or at any later time -private void InitializeExample6() +private void tabControl6_TabItemClosing(object sender, TabViewTabCloseRequestedEventArgs e) {{ - ResetExample6Tabs(); - - tabControl.RegisterTabClosingEvent((menuControl, e) => + if (e.Tab.Tag is ""ConfirmClose"") {{ - if (e.Tab.Tag is ""ConfirmClose"") - {{ - var msgResult = MessageBox.Show(""Do you want to close this tab?"", ""Confirm"", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (msgResult != MessageBoxResult.OK) - {{ - e.Cancel = true; - return; - }} - }} - else if (e.Tab.Tag is ""NiceTry"") + var msgResult = MessageBox.Show(""Do you want to close this tab?"", ""Confirm"", MessageBoxButton.OKCancel, MessageBoxImage.Question); + if (msgResult != MessageBoxResult.OK) {{ e.Cancel = true; - - if ((e.Tab.Header as string) != NiceTry) - e.Tab.Header = NiceTry; - else e.Tab.Header = ""You can't close me!""; - return; }} - }}); + }} + else if (e.Tab.Tag is ""NiceTry"") + {{ + e.Cancel = true; + + if ((e.Tab.Header as string) != NiceTry) + e.Tab.Header = NiceTry; + else e.Tab.Header = ""You can't close me!""; + + return; + }} + }} "; From 8cfef3b6d2fcfe40476dd6f4a5b43cbe45581db5 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 18 Nov 2025 14:28:01 +0800 Subject: [PATCH 03/12] chore: remove TabControlTest project --- samples/TabControlTest/App.xaml | 15 ----- samples/TabControlTest/App.xaml.cs | 13 ----- samples/TabControlTest/AssemblyInfo.cs | 10 ---- samples/TabControlTest/MainWindow.xaml | 13 ----- samples/TabControlTest/MainWindow.xaml.cs | 58 -------------------- samples/TabControlTest/TabControlTest.csproj | 14 ----- 6 files changed, 123 deletions(-) delete mode 100644 samples/TabControlTest/App.xaml delete mode 100644 samples/TabControlTest/App.xaml.cs delete mode 100644 samples/TabControlTest/AssemblyInfo.cs delete mode 100644 samples/TabControlTest/MainWindow.xaml delete mode 100644 samples/TabControlTest/MainWindow.xaml.cs delete mode 100644 samples/TabControlTest/TabControlTest.csproj diff --git a/samples/TabControlTest/App.xaml b/samples/TabControlTest/App.xaml deleted file mode 100644 index d2b6c52b..00000000 --- a/samples/TabControlTest/App.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/samples/TabControlTest/App.xaml.cs b/samples/TabControlTest/App.xaml.cs deleted file mode 100644 index 15aa2e83..00000000 --- a/samples/TabControlTest/App.xaml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Configuration; -using System.Data; -using System.Windows; - -namespace TabControlTest; - -/// -/// Interaction logic for App.xaml -/// -public partial class App : Application -{ -} - diff --git a/samples/TabControlTest/AssemblyInfo.cs b/samples/TabControlTest/AssemblyInfo.cs deleted file mode 100644 index cc29e7f7..00000000 --- a/samples/TabControlTest/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Windows; - -[assembly:ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] diff --git a/samples/TabControlTest/MainWindow.xaml b/samples/TabControlTest/MainWindow.xaml deleted file mode 100644 index 3e3585bf..00000000 --- a/samples/TabControlTest/MainWindow.xaml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/samples/TabControlTest/MainWindow.xaml.cs b/samples/TabControlTest/MainWindow.xaml.cs deleted file mode 100644 index c56b5c70..00000000 --- a/samples/TabControlTest/MainWindow.xaml.cs +++ /dev/null @@ -1,58 +0,0 @@ -using iNKORE.UI.WPF.Modern.Controls; -using System.Collections.ObjectModel; -using System.Windows; -using System.Windows.Controls; - -namespace TabControlTest; - -/// -/// Interaction logic for MainWindow.xaml -/// -public partial class MainWindow : Window -{ - public MainWindow() - { - InitializeComponent(); - - DataContext = this; - AddTestingMenuItems(); - - tabControl.RegisterTabClosingEvent((menuControl, e) => - { - if (e.Tab.Tag is not "ConfirmClose") - { - TabItems.Remove(e.Tab); - return; - } - - var msgResult = MessageBox.Show("Confirm closing?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question); - if (msgResult != MessageBoxResult.OK) - { - e.Cancel = true; - return; - } - - // when using ItemsSource, manually remove tab item. - TabItems.Remove(e.Tab); - }); - } - - public ObservableCollection TabItems { get; } = []; - - private void AddTestingMenuItems() - { - var item1 = new TabItem() - { - Header = "Closeable" - }; - - var item2 = new TabItem() - { - Header = "ConfirmToClose", - Tag = "ConfirmClose" - }; - - TabItems.Add(item1); - TabItems.Add(item2); - } -} \ No newline at end of file diff --git a/samples/TabControlTest/TabControlTest.csproj b/samples/TabControlTest/TabControlTest.csproj deleted file mode 100644 index 83ac89e9..00000000 --- a/samples/TabControlTest/TabControlTest.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - WinExe - net8.0-windows - enable - enable - true - - - - - - From 24e9c6947f00c2a646a639ce950bc720cc4390a7 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 18 Nov 2025 14:31:30 +0800 Subject: [PATCH 04/12] chore: update sln file --- iNKORE.UI.WPF.Modern.sln | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/iNKORE.UI.WPF.Modern.sln b/iNKORE.UI.WPF.Modern.sln index 58890bb6..b9cb6b51 100644 --- a/iNKORE.UI.WPF.Modern.sln +++ b/iNKORE.UI.WPF.Modern.sln @@ -59,8 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SettingsNavigationTest", "s EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ButtonsOnTitlebar", "samples\ButtonsOnTitlebar\ButtonsOnTitlebar.csproj", "{B7A35355-ED5B-494C-9BB8-6EBA1155E60E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TabControlTest", "samples\TabControlTest\TabControlTest.csproj", "{103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -395,26 +393,6 @@ Global {B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x64.Build.0 = Release|Any CPU {B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x86.ActiveCfg = Release|Any CPU {B7A35355-ED5B-494C-9BB8-6EBA1155E60E}.Release|x86.Build.0 = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM.ActiveCfg = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM.Build.0 = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|ARM64.Build.0 = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x64.ActiveCfg = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x64.Build.0 = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x86.ActiveCfg = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Debug|x86.Build.0 = Debug|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|Any CPU.Build.0 = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM.ActiveCfg = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM.Build.0 = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM64.ActiveCfg = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|ARM64.Build.0 = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x64.ActiveCfg = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x64.Build.0 = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x86.ActiveCfg = Release|Any CPU - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -435,7 +413,6 @@ Global {84C80EA6-0F9C-49CF-AB66-5696CC888CA7} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128} {AF682B4E-6A51-474A-8D80-0738A94C72FA} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128} {B7A35355-ED5B-494C-9BB8-6EBA1155E60E} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128} - {103A71A3-95FD-60C8-2D1F-3AA459BD0DDB} = {A96F98E9-18B5-4863-8F28-9B7BDF70A128} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6251E140-0FAA-4DE9-B245-1C5BE188E578} From b1fcbb96a257c358e30e676fed40ccffa76c7020 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 18 Nov 2025 16:16:17 +0800 Subject: [PATCH 05/12] refactor: (core/TabControl) close handling and add IsClosable support --- .../Pages/Controls/Windows/TabViewPage.xaml | 53 ++++-- .../Controls/Windows/TabViewPage.xaml.cs | 54 +++++- .../Controls/Helpers/TabControlHelper.cs | 26 +-- .../Controls/Helpers/TabItemHelper.cs | 175 +++++++++++------- .../Themes/Controls/TabControl.xaml | 22 +-- 5 files changed, 217 insertions(+), 113 deletions(-) diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml index 89d08673..3d751d55 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TabViewPage.xaml @@ -8,7 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" - mc:Ignorable="d" d:DesignWidth="734.51"> + mc:Ignorable="d" d:DesignWidth="907.31">