Skip to content

Commit ba3858e

Browse files
committed
fix: (core/TabControl) check for closable tab before closing
1 parent c021af5 commit ba3858e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/iNKORE.UI.WPF.Modern/Controls/Helpers/TabItemHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ void CanExecuteCustomCommand(object sender, CanExecuteRoutedEventArgs e)
278278
SetCloseTabButtonCommand(item, CloseTabButtonCommand);
279279

280280
// Cleanup previous bindings
281-
282281
foreach (var binding in item.CommandBindings)
283282
{
284283
if (binding is CommandBinding cmb && cmb.Command == CloseTabButtonCommand
@@ -296,6 +295,7 @@ private static void CloseButton_Click(object sender, RoutedEventArgs e)
296295

297296
var item = closeButton.FindAscendant<TabItem>();
298297
if (item.FindAscendant<TabControl>() is not { } tabControl) return;
298+
if (GetIsClosable(item) == false) return;
299299

300300
var args = new TabViewTabCloseRequestedEventArgs(TabControlHelper.TabCloseRequestedEvent, item.Content, item);
301301
tabControl.RaiseEvent(args);

0 commit comments

Comments
 (0)