mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2025-12-06 18:20:47 +01:00
fix: prevent closing only tab
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user