Esempio n. 1
0
        /// <summary>
        /// Removes all items except one passed in as parameter
        /// </summary>
        /// <param name="closableTabItem">Close all closable items except this one</param>
        internal void CloseAllButThis(ClosableTabItem closableTabItem)
        {
            List <TabItem> items = new List <TabItem>(InternalChildren);

            foreach (ClosableTabItem item in items)
            {
                if (item != closableTabItem && item.CanClose)
                {
                    RemoveItem(item);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Removes tab item.
        /// </summary>
        /// <param name="item">Tab item to remove.</param>
        internal void RemoveItem(ClosableTabItem item)
        {
            var args = new ClosableItemEventArgs(item);

            if (ItemClosing != null)
            {
                ItemClosing(this, args);

                if (args.Cancel)
                {
                    return;
                }
            }

            item.NotifyClosed();

            this.Items.Remove(item);
        }