fix: prevent closing only tab

This commit is contained in:
estrogen elf
2025-05-29 15:32:24 -05:00
parent a5f49c48b8
commit ef16642c04

View File

@@ -13,7 +13,12 @@ public partial class EndpointsTabView : UserControl
private void TabView_TabCloseRequested(FluentAvalonia.UI.Controls.TabView sender, FluentAvalonia.UI.Controls.TabViewTabCloseRequestedEventArgs args) private void TabView_TabCloseRequested(FluentAvalonia.UI.Controls.TabView sender, FluentAvalonia.UI.Controls.TabViewTabCloseRequestedEventArgs args)
{ {
if (args.Tab.Content is EndpointItem item) if (args.Tab.Content is EndpointItem item && sender.TabItems is IList tabItems)
((IList)sender.TabItems).Remove(item); {
if (tabItems.Count > 1)
{
tabItems.Remove(item);
}
}
} }
} }