Exemplo n.º 1
0
        void header_TabPageClose(TabItem closedTabItem)
        {
            int index = Items.IndexOf(closedTabItem);

            if (index == -1)
            {
                return;
            }

            //激发事件

            TabPageClosedEventArgs args = new TabPageClosedEventArgs()
            {
                TabItemIndex = index, ClosedTabItem = closedTabItem
            };

            if (TabPageClosed != null)
            {
                TabPageClosed(closedTabItem, args);
            }
            //移除选项卡
            Items.RemoveAt(index);
        }
Exemplo n.º 2
0
 void DBtabContainer_TabPageClosed(object sender, TabPageClosedEventArgs e)
 {
     //保存被关闭的选项卡的数据
     DBInfoTab closedTab = e.ClosedTabItem.Content as DBInfoTab;
     //如果被关闭的是包容有被剪切节点的选项卡,则设置相关的变量为null
     if (cutNodeSourceTab != null && cutNodeSourceTab == closedTab)
     {
         cutNodeSourceTab = null;
         cutNode = null;
     }
     //从参数中移除本选项卡所对应的DbInfo对象
     int index = SystemConfig.configArgus.DbInfos.IndexOf(closedTab.dbInfoObject);
     if (index != -1)
     {
         SystemConfig.configArgus.DbInfos.RemoveAt(index);
     }
     SaveDbTabDataToDB(closedTab);
 }
        void header_TabPageClose(TabItem closedTabItem)
        {
            int index = Items.IndexOf(closedTabItem);
            if (index == -1)
            {
                return;
            }

            //激发事件

             TabPageClosedEventArgs args = new TabPageClosedEventArgs()
             {
                 TabItemIndex=index, ClosedTabItem=closedTabItem
             };
             if (TabPageClosed != null)
             {
                 TabPageClosed(closedTabItem, args);
             }
            //移除选项卡
             Items.RemoveAt(index);
        }