Beispiel #1
0
        /// <summary>
        /// 关闭选项卡
        /// </summary>
        private void CloseTabItem()
        {
            if (string.IsNullOrEmpty(Name) || Name != "PART_Close_TabItem")
            {
                return;
            }

            TabItem itemclose = VisualTreeHelperEx.FindVisualParent <TabItem>(this);

            if (itemclose == null)
            {
                return;
            }

            (itemclose.Parent as TabControl).Items.Remove(itemclose);
            var args = new RoutedEventArgs(TabItemClose.CloseItemEvent, itemclose);

            itemclose.RaiseEvent(args);
        }