* UITabControl: 修改删除页面时的页面跳转
This commit is contained in:
parent
ce29048f92
commit
8e9b4eea98
Binary file not shown.
@ -65,6 +65,7 @@ namespace Sunny.UI
|
|||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
|
|
||||||
DisposeTabPageAfterRemove = true;
|
DisposeTabPageAfterRemove = true;
|
||||||
|
AutoClosePage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConcurrentDictionary<TabPage, string> TipsTexts = new ConcurrentDictionary<TabPage, string>();
|
private ConcurrentDictionary<TabPage, string> TipsTexts = new ConcurrentDictionary<TabPage, string>();
|
||||||
@ -692,7 +693,7 @@ namespace Sunny.UI
|
|||||||
|
|
||||||
public event OnAfterRemoveTabPage AfterRemoveTabPage;
|
public event OnAfterRemoveTabPage AfterRemoveTabPage;
|
||||||
|
|
||||||
[DefaultValue(false)]
|
[DefaultValue(true)]
|
||||||
[Description("多页面框架时,包含UIPage,在点击Tab页关闭时关闭UIPage"), Category("SunnyUI")]
|
[Description("多页面框架时,包含UIPage,在点击Tab页关闭时关闭UIPage"), Category("SunnyUI")]
|
||||||
public bool AutoClosePage
|
public bool AutoClosePage
|
||||||
{
|
{
|
||||||
@ -714,19 +715,26 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
TabPage tabPage = TabPages[index];
|
TabPage tabPage = TabPages[index];
|
||||||
|
var pages = tabPage.GetControls<UIPage>();
|
||||||
if (AutoClosePage)
|
for (int i = 0; i < pages.Count; i++)
|
||||||
{
|
{
|
||||||
var pages = tabPage.GetControls<UIPage>();
|
if (AutoClosePage)
|
||||||
for (int i = 0; i < pages.Count; i++)
|
|
||||||
{
|
{
|
||||||
pages[i].Final();
|
pages[i].Final();
|
||||||
pages[i].Dispose();
|
pages[i].Dispose();
|
||||||
pages[i] = null;
|
pages[i] = null;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pages[i].Parent = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TabCount > 1 && index > 0)
|
||||||
|
{
|
||||||
|
SelectedTab = TabPages[index - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedTab = TabPages[index > 0 ? index - 1 : 0];
|
|
||||||
TabPages.Remove(tabPage);
|
TabPages.Remove(tabPage);
|
||||||
AfterRemoveTabPage?.Invoke(this, index);
|
AfterRemoveTabPage?.Invoke(this, index);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user